Simple Conceptual Pickling problems
chris lyon
chris.lyon at spritenote.co.uk
Tue Jul 2 07:56:47 EDT 2002
> > SystemError: Failed to import class Programme from module __main__
>
> This is the hint. The module's name when the pickle was created was
> __main__, which only happens when the module is not imported, but is run
> directly. You need to pickle and unpickle from within the same context,
> eg, use import in both cases.
>
> HTH,
> Emile van Sebille
> emile at fenx.com
So , if I understand you, Because I ran the original code using the
Pythonwin environment, I produced the objects in module __main__ NOT in the
module I though they were being created in ( in my case a module called
octavia which contains the class Programmes).
When I then ran with my test module, which imported octavia, The Unpickle
process believed it was trying to unpickle objects defined in __main__ NOT
from within octavia ?
So should I then have a module 'above' my octavia module which will import
octavia for it to work?
Chris
More information about the Python-list
mailing list