cPickle problems
Jeff Poole
korvus at gmail.com
Thu Nov 16 21:21:51 EST 2006
Good idea. Well, I did that, and I found out that the object causing
problems is a ParseResults object (a class from PyParsing) and that the
__getstate__ member is in fact an empty string (''). I'm not sure
where this leaves me... The PyParsing code clearly never creates such
a member and my code never creates it. In fact, searching all the code
involved (not including what is in /usr/lib/python2.4 ), shows no use
of __getstate__ at all (or even the string "getstate").
Ok, I figured it out. ParseResults has the following member:
def __getattr__( self, name ):
if name not in self.__slots__:
if self.__tokdict.has_key( name ):
if name not in self.__accumNames:
return self.__tokdict[name][-1][0]
else:
return ParseResults([ v[0] for v in
self.__tokdict[name] ])
else:
return ""
return None
So when something tries to retrieve .__getstate__, it returns an empty
string. If I tell it to raise an AttributeException instead, then I
get this message:
TypeError: a class that defines __slots__ without defining __getstate__
cannot be pickled
I think I need to talk to the author of PyParsing about this one...
Thanks for your help!
Jeff
> Someway, self.__getstate__ is a string, not a method...
> Since it fails inside a python module, you could print some debug
> information to see what happens, like repr(self), type(self), repr(getstate)...
>
>
>
> --
> Gabriel Genellina
> Softlab SRL
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list