kfira / python-multiprocessing

Automatically exported from code.google.com/p/python-multiprocessing
Other
0 stars 0 forks source link

multiprocessing.Queue PicklingError #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Small script, adding few tuples with objects to the Queue
gives me:

--------------8<-------------
Traceback (most recent call last):
  File
"/home/some_path/src/multiprocessing/multiprocessing-2.6.0.2-py2.4-linux-i686.eg
g/multiprocessing/queues.py",
line 242, in _feed
    send(obj)
PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup
__builtin__.instancemethod failed
--------------8<-------------

multiprocessing-2.6.0.2-py2.4-linux-i686.egg (installed via easy_install
under the custom --dest-dir)
Python 2.4.4
debian, kernel 2.6.x

But the same script works fine with Queue.Queue.

I will try to give you more details including src code of a script if required.

Original issue reported on code.google.com by pawciob...@gmail.com on 17 Dec 2008 at 5:21

GoogleCodeExporter commented 8 years ago
I can confirm that this issue occurs when using any class or instance method. 
In 
fact, anything that requires a closure to pickle seems to raise this error.

Original comment by jeffober on 15 Feb 2009 at 6:59

GoogleCodeExporter commented 8 years ago
Protocol used in multiprocessing involves pickling during data exchange and as 
described in 
http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled 
instance methods cannot be 
pickled. If adding a collection of objects to the queue raises such an error 
supposedly their class definition 
wasn't available at module top level.

Original comment by mchrus...@gmail.com on 28 Aug 2009 at 12:24