Python multiprocessing.Process is executing the wrong target (bundled with py2exe)

I have a problem.

i using python (2.7.7, 32bit) and py2exe (0.6.9) on Windows7 (64 bit).

my application structure, such as:

from multiprocessing import Process def child(): print "child" def main(): print "main" p = Process(target=child) p.start() p.join() if __name__ == "__main__": main() 

(1) result before packing:

 main child 

(2) result after packing:

 main main main ...(forever) 

I want to receive (1) after packing.

please tell me how to receive (1) after packing.

love.

+2
source share
1 answer

As stated in the comments, you need to call multiprocessing.freeze_support() when packing the Python script into an executable file for use on Windows. This call should appear immediately after if __name__ == '__main__': before calling main() .

Link to multiprocessing documents .freeze

+1
source

Source: https://habr.com/ru/post/1215573/


All Articles