Pickle Encoding Errors

Christian Heimes lists at cheimes.de
Sun Sep 20 08:29:39 EDT 2009


Dan wrote:
> Error unpickling
> Pickling from destructor...
> Exception exceptions.LookupError: 'unknown encoding: raw-unicode-
> escape' in <bound method PickleTest.__del__ of <__main__.PickleTest
> instance at 0xb7d3decc>> ignored
> 
> If I now change destruct to 0 the output is:
> 
> Error unpickling
> Pickling from __main__...
> Pickled just fine
> 
> Even more odd is that with an existing "pickle.txt" and destruct set
> to 1 it seems to work correctly:
> 
> Unpickled just fine
> Pickling from destructor...
> Pickled just fine
> 
> 
> 
> I'm running Python 2.5.4 on Debian Sid.
> 
> If anybody understands the error please enlighten me.

__del__ is called in an indeterministic order. Most of the Python
environment is already gone when your __del__ method is called. The
pickle module doesn't have enough bits left to fulfill its job.

Christian




More information about the Python-list mailing list