classification
Title: multiprocessing.Pool() problem in windows
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: SirLalala, amaury.forgeotdarc (2)
Priority: Keywords

Created on 2009-10-14 11:42 by SirLalala, last changed 2009-10-14 12:04 by amaury.forgeotdarc.

Files
File name Uploaded Description Edit Remove
prueba.py SirLalala, 2009-10-14 11:42 test code
Messages (2)
msg93975 - (view) Author: Alex (SirLalala) Date: 2009-10-14 11:42
Maybe I didn't understand how multiprocessing works but when running the
test code below I get 200+ processes in Windows and it never finishes.
It works fine on Linux.
msg93977 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) Date: 2009-10-14 12:04
This difference between Unix and Windows is documented there:
http://docs.python.org/library/multiprocessing.html#windows
Please carefully read the paragraph named "Safe importing of main module".

You will certainly need to add a condition like
   if __name__ == '__main__':
so that subprocesses (which start a new Python interpreter from the
start) don't start another Pool themselves.
History
Date User Action Args
2009-10-14 12:04:11amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg93977

resolution: invalid
2009-10-14 11:42:48SirLalalacreate