[DB-SIG] Question on shelve/pickle and namespaces...

Stuart Hungerford stuart.hungerford at anu.edu.au
Wed Feb 4 23:41:16 EST 2004


Hi all,

I hope this is a suitable forum to ask this shelve related
question: I figured if any group or SIG would know, it would
be this one.

I have a python module foo.py which contains:

    class A(object): ...
    class B(object): ...

As well as a class that uses shelve (which in turn is
using dumbdbm):

    class foo(object): ...
       // uses a shelve internally

The methods of foo shelve and restore A and B instances
*but* shelve seems to be looking in the wrong places for
the definitions of A and B when they're "unshelved",
giving the error:

    AttributeError: 'module' object has no attribute 'A'

How can I persuade shelve to look in other namespaces for
A and B?

Any advice much appreciated,




Cheers,

Stu

--
:: Stuart Hungerford (stuart.hungerford at anu.edu.au)
:: ANU Internet Futures Group




More information about the DB-SIG mailing list