[Python-Dev] multiprocessing not compatible with functional.partial
Christian Heimes
lists at cheimes.de
Thu Feb 12 15:06:31 CET 2009
Neal Becker schrieb:
> If the argument to pool.map (f, args)
> is
> f = functional.partial (my_func, some_keyword_arg=whatever)
>
> I get:
>
> Traceback (most recent call last):
> File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-
> self.run()
> File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-
> self._target(*self._args, **self._kwargs)
> File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-
> task = get()
> File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-
> return recv()
> TypeError: type 'partial' takes at least one argument
functool.partial instances are not picklable. You have to teach
multiprocessing how to serialize a functool.partial instance.
Christian
More information about the Python-Dev
mailing list