471,350 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Where does shelve look for unshelved class definitions?

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
1 1350
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.

Similar topics

6 posts views Thread by Rami A. Kishek | last post: by
1 post views Thread by Matthew Barnes | last post: by
1 post views Thread by Eric Wichterich | last post: by
reply views Thread by Ray O | last post: by
4 posts views Thread by Terry Hancock | last post: by
1 post views Thread by Paul Rubin | last post: by
3 posts views Thread by Michele Petrazzo | last post: by
1 post views Thread by max.aginaga | last post: by
reply views Thread by Gabriel Genellina | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.