cPickle vs pickle discrepancy

Zac Burns zac256 at gmail.com
Tue Jan 6 02:04:30 CET 2009


I have a module that attempts to pickle classes defined in that module.

I get an error of the form:
PicklingError: Can't pickle <class 'Module.SubModule.Class'>: import
of module Module.SubModule failed
when using cPickle (protocol -1, python version 2.5.1).

The module has already been imported and is in sys.modules when the
exception is raised.

Using pickle instead of cPickle works, but the section of the code is
performance critical.

How can this be worked around?

Zachary Burns
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games

More information about the Python-list mailing list