All example concurrent.futures code is failing with “BrokenProcessPool”

后端 未结 2 492
北海茫月
北海茫月 2020-12-03 04:48

I am trying to get a basic understanding of this before I create the actual application I need. I recently moved over from 2.7 to 3.3.

A direct copy-paste of this co

2条回答
  •  猫巷女王i
    2020-12-03 05:25

    Under Windows, it is important to protect the main loop of code to avoid recursive spawning of subprocesses when using processpoolexecutor or any other parallel code which spawns new processes.

    Basically, all your code which creates new processes must be under if __name__ == '__main__': , for the same reason you cannot execute it in interpreter.

提交回复
热议问题