Python multiprocessing example not working

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).

Leave a Comment