[DFD] problems with new persistent technique

Travis travis+ml-dfd at subspacefield.org
Wed Oct 22 05:43:33 CEST 2008


So I ran into some problems with the new persistent technique I was
planning on using.

The problem, essentially, is that while you can persist objects, if
their class is not defined at unpickle time, it generates an
exception:

>>> p['cf']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/shelve.py", line 113, in __getitem__
    value = Unpickler(f).load()
AttributeError: 'module' object has no attribute 'command_dispatch'

Here p is the shelf, cf is an object which held a reference to an
instance of command_dispatch.  Note the bizarre error message;
module must be where python stores all the classes, and it must store
them as attributes.

While I can simply put that class in the shelf, it does not help with
the run-time error when unpickling.  Nor is it practical to know, in
advance, what classes objects on a given shelf may use.

-- 
Crypto ergo sum.  http://www.subspacefield.org/~travis/
Do unto other faiths as you would have them do unto yours.
If you are a spammer, please email john at subspacefield.org to get blacklisted.


More information about the DFD mailing list