[issue5509] cPickle - module object has no attribute

Nathaniel Troutman report at bugs.python.org
Wed Mar 18 18:38:04 CET 2009

Nathaniel Troutman <locutusofbeira at yahoo.com> added the comment:

I believe I've tracked down the problem. When you run a python module
directly (ie "python Foo.py") any classes defined in the module have
their '__module__' attribute set to '__main__'. Which means the pickle
says the class is in '__main__' of whatever module is trying to load the

I think it would make more sense to actually include the module name,
this means that an external module need simply ensure that the pickled
class's module be imported with the correct name.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list