[issue24202] Multiprocessing Pool not working for userdefined function
Paul Moore
report at bugs.python.org
Fri May 15 16:07:07 CEST 2015
Paul Moore added the comment:
OK, if it's not reproducible in a standalone script, I'll close this as it's expected behaviour.
Correcting the typo in your script (__name__ == "__main__"), I ran it and it worked as expected on my system:
>type multi.py
import multiprocessing
import numpy
def f(x):
return x*x
if __name__ == "__main__":
p= multiprocessing.Pool(5)
print(p.map(numpy.sqrt,[1,2,3,4]))
print(p.map(f,[1,2,3,4]))
PS 15:05 {00:00.089} C:\Work\Scratch
>py .\multi.py
[1.0, 1.4142135623730951, 1.7320508075688772, 2.0]
[1, 4, 9, 16]
I'm not sure why you weren't getting output, but it doesn't look like a Python issue.
----------
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24202>
_______________________________________
More information about the Python-bugs-list
mailing list