Python multiprocessing example not working

multiprocessing, python

Solution

My guess is that you are using IDLE to try to run this script. Unfortunately, this example will not run correctly in IDLE. Note the comment at the beginning of the docs:

Note Functionality within this package requires that the main module be importable by the children. This is covered in Programming guidelines however it is worth pointing out here. This means that some examples, such as the multiprocessing.Pool examples will not work in the interactive interpreter.

The `__main__` module is not importable by children in IDLE, even if you run the script as a file with IDLE (which is commonly done with F5).

Problem

I am trying to learn how to use `multiprocessing`but I can't get it to work. Here is the code right out of the documentation ``` from multiprocessing import Process def f(name): print 'hello', name if __name__ == '__main__': p = Process(target=f, args=('bob',)) p.start() p.join() ``` it should output ``` >>> 'hello bob' ``` but instead i get ``` >>> ``` no errors or other messages, it just sits there, It is running in `IDLE` from a saved .py file on a Windows 7 machine with the 32-bit version of Python 2.7

Original source