[C++-sig] Boost Python exceptions cannot be pickled

Faheem Mitha faheem at faheem.info
Mon Apr 23 18:11:50 CEST 2012


Hi,

Briefly, when using the multiprocessing module, when exceptions are 
thrown, they need to be pickleable in order to propagate, since that is 
how multiprocessing passes information around.

See 
http://stackoverflow.com/questions/8785899/hang-in-python-script-using-sqlalchemy-and-multiprocessing 
and Python bug http://bugs.python.org/issue1692335 for background.

I've reported bugs http://bugs.python.org/issue13751 and 
http://www.sqlalchemy.org/trac/ticket/2371 and 
http://psycopg.lighthouseapp.com/projects/62710-psycopg/tickets/90-psycopg-exceptions-cannot-be-pickled 
and http://bugs.python.org/issue13760 in this context. I've been reporting 
them as I came across them.

I can produce a complete example if necessary, but I think the problem is 
pretty obvious. Let me know whether you require followup action from me. 
Specifically, do you want me to report a bug?

See below the traceback I just ran into. Please CC me on all replies. 
Thanks.

                                                            Regards, Faheem

*******************************************************************

Process PoolWorker-1:
Traceback (most recent call last):
   File "/usr/lib/python2.6/multiprocessing/process.py", line 232, in 
_bootstrap
Process PoolWorker-2:
Traceback (most recent call last):
   File "/usr/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap
     self.run()
   File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run
     self._target(*self._args, **self._kwargs)
   File "/usr/lib/python2.6/multiprocessing/pool.py", line 71, in worker
     self.run()
   File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run
     self._target(*self._args, **self._kwargs)
   File "/usr/lib/python2.6/multiprocessing/pool.py", line 71, in worker
     put((job, i, result))
   File "/usr/lib/python2.6/multiprocessing/queues.py", line 366, in put
     put((job, i, result))
   File "/usr/lib/python2.6/multiprocessing/queues.py", line 366, in put
     return send(obj)
PicklingError: Can't pickle <class 'Boost.Python.ArgumentError'>: import 
of module Boost.Python failed
     return send(obj)
PicklingError: Can't pickle <class 'Boost.Python.ArgumentError'>: import 
of module Boost.Python failed



More information about the Cplusplus-sig mailing list