multiprocessing and freezing on Windows
SK
sgm at objexx.com
Sat Jul 4 21:15:43 EDT 2009
To add a bit more information, I found that I needed to patch
get_command_line in multiprocessing/forking.py replacing:
if getattr(sys, 'frozen', False):
return [sys.executable, '--multiprocessing-fork']
else:
prog = 'from multiprocessing.forking import main; main()'
return [_python_exe, '-c', prog, '--multiprocessing-fork']
with:
if WINEXE:
prog = 'from multiprocessing.forking import main; main()'
return [_python_exe, '-c', prog, '--multiprocessing-fork']
elif getattr(sys, 'frozen', False):
return [sys.executable, '--multiprocessing-fork']
else:
prog = 'from multiprocessing.forking import main; main()'
return [_python_exe, '-c', prog, '--multiprocessing-fork']
and then using py2exe I can get a working "frozen" package if I
include pythonw.exe and a subset of Python's Lib directory in my
package and call multiprocessing.set_executable to point to that
pythonw.exe.
Does the above patch address a real bug?
Is packaging with multiprocessing supposed to be this hard? If so,
some documentation is needed.
More information about the Python-list
mailing list