En Mon, 21 May 2007 16:24:55 -0300, Berthold Höllmann  
<[EMAIL PROTECTED]> escribió:
> Jeffrey Barish <[EMAIL PROTECTED]> writes:
>
>> I have a class derived from string that is used in a pickle.  In the new
>> version of my program, I moved the module containing the definition of  
>> the class.  Now the unpickle fails because it doesn't find the module.   
>> I
>
> You can fiddle with the file class used reading the pickled file. I.e.
> the "read()" method could replace each instance of "foo.myclass" by
> "greatnewmodule.mynewclass" could bring you back in the game.

There is a hook in the pickle module (load_global or find_global) that you  
can override instead, and it's exactly for this usage, see:
http://docs.python.org/lib/pickle-sub.html

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to