Pickle Encoding Errors

Dan daniel.maraguirre at googlemail.com
Sun Sep 20 08:54:26 EDT 2009


On 20 Sep, 13:29, Christian Heimes <li... at cheimes.de> wrote:
> 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

Thank you both for your advice. Python is very new to me so still
plenty to learn.
I still think it's interesting that once the file exists there is no
error generated but at least I know how it should be done.



More information about the Python-list mailing list