久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='Dv9kR'></small><noframes id='Dv9kR'>

      <bdo id='Dv9kR'></bdo><ul id='Dv9kR'></ul>
  • <i id='Dv9kR'><tr id='Dv9kR'><dt id='Dv9kR'><q id='Dv9kR'><span id='Dv9kR'><b id='Dv9kR'><form id='Dv9kR'><ins id='Dv9kR'></ins><ul id='Dv9kR'></ul><sub id='Dv9kR'></sub></form><legend id='Dv9kR'></legend><bdo id='Dv9kR'><pre id='Dv9kR'><center id='Dv9kR'></center></pre></bdo></b><th id='Dv9kR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Dv9kR'><tfoot id='Dv9kR'></tfoot><dl id='Dv9kR'><fieldset id='Dv9kR'></fieldset></dl></div>

      <tfoot id='Dv9kR'></tfoot>
    1. <legend id='Dv9kR'><style id='Dv9kR'><dir id='Dv9kR'><q id='Dv9kR'></q></dir></style></legend>

        multiprocessing.Queue 的管道損壞錯誤

        Broken pipe error with multiprocessing.Queue(multiprocessing.Queue 的管道損壞錯誤)
        1. <i id='klIFw'><tr id='klIFw'><dt id='klIFw'><q id='klIFw'><span id='klIFw'><b id='klIFw'><form id='klIFw'><ins id='klIFw'></ins><ul id='klIFw'></ul><sub id='klIFw'></sub></form><legend id='klIFw'></legend><bdo id='klIFw'><pre id='klIFw'><center id='klIFw'></center></pre></bdo></b><th id='klIFw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='klIFw'><tfoot id='klIFw'></tfoot><dl id='klIFw'><fieldset id='klIFw'></fieldset></dl></div>

            • <bdo id='klIFw'></bdo><ul id='klIFw'></ul>
              <legend id='klIFw'><style id='klIFw'><dir id='klIFw'><q id='klIFw'></q></dir></style></legend>
                  <tbody id='klIFw'></tbody>
                • <small id='klIFw'></small><noframes id='klIFw'>

                  <tfoot id='klIFw'></tfoot>

                • 本文介紹了multiprocessing.Queue 的管道損壞錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  在 python2.7 中,multiprocessing.Queue 在從函數(shù)內(nèi)部初始化時會引發(fā)錯誤.我提供了一個重現(xiàn)問題的最小示例.

                  In python2.7, multiprocessing.Queue throws a broken error when initialized from inside a function. I am providing a minimal example that reproduces the problem.

                  #!/usr/bin/python
                  # -*- coding: utf-8 -*-
                  
                  import multiprocessing
                  
                  def main():
                      q = multiprocessing.Queue()
                      for i in range(10):
                          q.put(i)
                  
                  if __name__ == "__main__":
                      main()
                  

                  拋出下面的斷管錯誤

                  Traceback (most recent call last):
                  File "/usr/lib64/python2.7/multiprocessing/queues.py", line 268, in _feed
                  send(obj)
                  IOError: [Errno 32] Broken pipe
                  
                  Process finished with exit code 0
                  

                  我無法解釋原因.我們不能從函數(shù)內(nèi)部填充 Queue 對象肯定會很奇怪.

                  I am unable to decipher why. It would certainly be strange that we cannot populate Queue objects from inside a function.

                  推薦答案

                  這里發(fā)生的是,當你調(diào)用 main() 時,它會創(chuàng)建 Queue,放入 10對象并結(jié)束函數(shù),垃圾收集其內(nèi)部的所有變量和對象,包括 Queue.但是您收到此錯誤是因為您仍在嘗試發(fā)送 Queue 中的最后一個號碼.

                  What happens here is that when you call main(), it creates the Queue, put 10 objects in it and ends the function, garbage collecting all of its inside variables and objects, including the Queue. BUT you get this error because you are still trying to send the last number in the Queue.

                  來自文檔文檔:

                  "當一個進程第一次將一個項目放入隊列時,一個 feeder 線程是開始將對象從緩沖區(qū)傳輸?shù)焦艿乐?"

                  "When a process first puts an item on the queue a feeder thread is started which transfers objects from a buffer into the pipe."

                  由于 put() 是在另一個 Thread 中進行的,它不會阻塞腳本的執(zhí)行,并允許在完成之前結(jié)束 main() 函數(shù)隊列操作.

                  As the put() is made in another Thread, it is not blocking the execution of the script, and allows to ends the main() function before completing the Queue operations.

                  試試這個:

                  #!/usr/bin/python
                  # -*- coding: utf-8 -*-
                  
                  import multiprocessing
                  import time
                  def main():
                      q = multiprocessing.Queue()
                      for i in range(10):
                          print i
                          q.put(i)
                      time.sleep(0.1) # Just enough to let the Queue finish
                  
                  if __name__ == "__main__":
                      main()
                  

                  應(yīng)該有一種方法可以加入隊列或阻止執(zhí)行,直到將對象放入Queue,您應(yīng)該查看文檔.

                  There should be a way to join the Queue or block execution until the object is put in the Queue, you should take a look in the documentation.

                  這篇關(guān)于multiprocessing.Queue 的管道損壞錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應(yīng)該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                • <legend id='aYD8h'><style id='aYD8h'><dir id='aYD8h'><q id='aYD8h'></q></dir></style></legend>

                      <bdo id='aYD8h'></bdo><ul id='aYD8h'></ul>
                      <tfoot id='aYD8h'></tfoot>
                          <tbody id='aYD8h'></tbody>
                      • <i id='aYD8h'><tr id='aYD8h'><dt id='aYD8h'><q id='aYD8h'><span id='aYD8h'><b id='aYD8h'><form id='aYD8h'><ins id='aYD8h'></ins><ul id='aYD8h'></ul><sub id='aYD8h'></sub></form><legend id='aYD8h'></legend><bdo id='aYD8h'><pre id='aYD8h'><center id='aYD8h'></center></pre></bdo></b><th id='aYD8h'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aYD8h'><tfoot id='aYD8h'></tfoot><dl id='aYD8h'><fieldset id='aYD8h'></fieldset></dl></div>

                          <small id='aYD8h'></small><noframes id='aYD8h'>

                            主站蜘蛛池模板: 久久久精品久久 | 91在线资源 | 亚洲一区二区久久 | avhd101在线成人播放 | 日本91av视频 | 国产免费高清 | 精品一区二区三区免费视频 | 九九伊人sl水蜜桃色推荐 | av黄色在线 | 日韩在线视频观看 | 成人精品鲁一区一区二区 | 欧美日韩一区二区三区四区五区 | 亚洲一区播放 | av香港经典三级级 在线 | 国产精品成人一区二区 | 风间由美一区二区三区在线观看 | 国产1区在线 | 国产电影一区二区在线观看 | 国产精品视频一二三区 | 日本一区二区不卡 | 91精品国产91久久久 | a级黄色片在线观看 | 亚洲第一av | 久久久久国产精品 | 精品美女久久久 | 国产伦一区二区三区久久 | 欧美在线资源 | 亚洲小视频在线播放 | 欧美视频中文字幕 | 日韩精品一区二区三区高清免费 | 日本一区二区三区四区 | 午夜影院在线观看 | 黄色网址在线免费观看 | 欧美成人免费在线视频 | 一区二区三区在线电影 | 国产精品乱码一区二三区小蝌蚪 | 最新中文字幕第一页视频 | 成年人在线视频 | 亚洲精品一区二区三区四区高清 | 国产丝袜一区二区三区免费视频 | 亚洲精品中文在线观看 |