If I run this simple code in IDLE in Python 2.7.8, it will pop a window saying "The program is still running! Do you want to kill it?".
from multiprocessing import Pool
def foo(x):
return x**2
if __name__ == '__main__':
pool = Pool(2)
pows = pool.map(foo, range(10))
print pows
Even if I do kill or not (it will ask twice) nothing will happen. I used to use Windows and I've just recently started using Mac OSX (10.9.4), and I don't know if I'm missing something here.
If I run the same code directly in the Python Shell in terminal, it will run fine. Same in iPython notebook. It just won't on IDLE, popping up that message box.
Any ideas? I'd like to keep using IDLE...
here's the log:
INFO:root:10221: Started process
INFO:root:10221: Defined foo
INFO:root:10221: __name__ == '__main__'
INFO:root:10221: pool created
This was a known issue with the previous version of Pycharm. If you upgrade with the latest version now you can safely use multiprocessing within the console of the IDE without running in this issue any longer.
See here for further informations: https://youtrack.jetbrains.com/issue/PY-14969
Ref this: https://docs.python.org/2/library/multiprocessing.html#introduction
Specifically, in the note:
Here's a similar question Child processes created with python multiprocessing module won't print
Example of logging activity to a file:
Example output for me:
Try the same thing yourself with the Process version.