multiprocessing

A forum for general discussion of the Python programming language.

multiprocessing

Postby honza » Sun Jun 09, 2013 1:07 pm

Good afternoon,

I have problem with basic example of multiprocessing. The p.map(), returns error and I do not know why. Problem you can see on picture and here is code:

from multiprocessing import Pool
p = Pool(5)
def f(x):
return x*x
p.map(f, [1,2,3])

Do you now where is a problem, please? Thank you and have a nice day.
Jan
Attachments
error_multi.png
error_multi.png (227.59 KiB) Viewed 266 times
honza
 
Posts: 1
Joined: Sun Jun 09, 2013 12:54 pm

Re: multiprocessing

Postby Yoriz » Sun Jun 09, 2013 6:01 pm

It tells you right before that example that the following example will not work in the interactive interpreter.

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. For example:
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 571
Joined: Fri Feb 08, 2013 1:35 am
Location: UK


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest