By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

Where does shelve look for unshelved class definitions?

P: n/a
Hi all,

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,
Stu
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
BG
This looks like a problem I had recently. Please take a look at this
news thread:

http://groups.google.com/groups?hl=n....nl%26rnum%3D1

I hope this link works ;-)

Berry.
Stuart Hungerford wrote:
Hi all,

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,
Stu

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.