Problem with multiprocessing

tleeuwenburg at gmail.com tleeuwenburg at gmail.com
Wed Sep 2 02:15:14 EDT 2009


I have a problem using multiprocessing in a simple way. I created a
file, testmp.py, with the following contents:

---------------------------------------------------
import multiprocessing as mp

p = mp.Pool(5)

def f(x):
  return x * x

print map(f, [1,2,3,4,5])
print p.map(f, [1,2,3,4,5])

----------------------------------------------------

I'm using 2.6 r26:66713, so not quite bleeding edge.

If I run 'python2.6 testmp.py' I get errors of exactly the kind
mentioned on docs.python.org for when multiprocessing is run using the
interactive interpreter. However, I'm obviously *not* running the
interactive interpreter.

Any suggestions?



More information about the Python-list mailing list