Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py2exe with multiprocessing fails to run the processes

I am using Python 2.6 over windows 7 and I am trying to use multiprocess:

p = Process(target=f, args=(SOME_ARGS))
p.start()
p.join()

while I run the code from CMD (using the interpreter) everything works fine, but after I create an exe file with py2exe, the execution of the process fails with the following error:

error: no such option: --multiprocessing-fork

all the solutions I found did not help. any ideas?

like image 243
jo_dman Avatar asked Nov 22 '12 13:11

jo_dman


2 Answers

You need a call to multiprocessing.freeze_support() when packaging a Python script into an executable for use on Windows. This call should come just after if __name__ == '__main__': before actually calling main()

like image 86
vdkotian Avatar answered Sep 22 '22 12:09

vdkotian


You know you are using a app of year 2008? (py2exe), python is in constant actualizations, and then gives problems with py2exe, I can give you a better solution...

You can use cxfreeze: http://cx-freeze.sourceforge.net/

Simply, easy, good, and actualized.

I hope this helped you.

like image 28
ElektroStudios Avatar answered Sep 19 '22 12:09

ElektroStudios