[ZODB-Dev] cPickle: state is not a directory/Upgrade to Zope 2.7failing

Jim Fulton jim at zope.com
Tue Nov 4 11:54:54 EST 2003


Tim Peters wrote:
> Recap:  Andreas has a Zope 2.6.2 site (Python 2.2.3, CMF 1.4), and is trying to
> migrate it to Zope 2.7 with Python 2.3.2.  He gets exceptions upon startup,
> coming out of _set_ghost_state, with cPickle complaining:
> 
>     cPickle.UnpicklingError: state is not a dictionary
> 
> [Tim]
> 
>>>So we need more info.  Two things:
>>>
>>>1. Fiddle _set_ghost_state to output repr(p) when this fails.
>>>   That is, I need to see the actual pickle, in all its gory glory.
>>>   All we can deduce from the above is that the state object is
>>>   neither None nor a dict (the error message told us it's not a
>>>   dict, and it wouldn't have gotten to that check if it were None).
> 
> 
> [Andreas Jung]
> 

...

> This pickle creates a DateTime object, and then *tries* to set its state from a
> tuple.  That's not legal -- a tuple makes no sense here.

That's a little missleading. The state can be anything. as long as the class
provides __setstate__ method that handles it.

It looks as though this pickle was written from a DateTime class with
custom __getstate__ and __setstate__.  This would be useful to save space.
I can find no evidence of this in CVS though. Is it possible that sombody
had installed such an optimization in Adreas' Zope 2.6 installation?
If so, somebody needs to migrate that forward to the 2.7 installation.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the ZODB-Dev mailing list