Simple Conceptual Pickling problems

chris lyon chris.lyon at spritenote.co.uk
Tue Jul 2 05:51:49 EDT 2002


I am trying to pickle instances of a class stored in a dictionary with a MD5
hash used as the key of the dictionary.

I can pickle them ok and when I examine the pickle file (I'm using the
default ASCII mode) I can see the instance data in the pickle file.

However when I try to load the pickle file After I have imported the module
from which it was all derived I get:-

SystemError: Failed to import class Programme from module __main__

now Programme is a top level class defined in the file I have imported
before I have opened the pickle file.
So why can't doesn't this work?
I fell it's important I understand this as conceptually I've obviously got
the wrong idea of what I'm doing.

Chris





More information about the Python-list mailing list