On 21/12/11 21:11:03, Andrew Berg wrote:
On 12/21/2011 1:29 PM, Ethan Furman wrote:
Anything that runs at import time should be protected by the `if
__name__ == '__main__'` idiom as the children will import the __main__
module.
So the child imports the parent and runs the spawn code again? That
makes sense.
It's platform dependent. On Windows, the child imports the parent
and you get the phenomenon your ran into. On Posix platforms,
multiprocessing uses fork(), and your code runs without problems.
It would still be a good idea to use the `if __name__ is '__main__'`
idiom, even on Posix platforms.
Hope this helps,
-- HansM
--
http://mail.python.org/mailman/listinfo/python-list