[Tutor] How does Shelve work?

S A buc40@bemail.org
Thu, 5 Sep 2002 13:48:13 -0700


Can someone please explain how the Shelve module works?

I tried to use a shelve.open (filename) command on a blank flat file and got an error saying that it could not determine the database type?

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/sw/lib/python2.2/shelve.py", line 158, in open
    return DbfilenameShelf(filename, flag)
  File "/sw/lib/python2.2/shelve.py", line 148, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag))
  File "/sw/lib/python2.2/anydbm.py", line 83, in open
    raise error, "db type could not be determined"
anydbm.error: db type could not be determined
>>> d = shelve.open('test2')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/sw/lib/python2.2/shelve.py", line 158, in open
    return DbfilenameShelf(filename, flag)
  File "/sw/lib/python2.2/shelve.py", line 148, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag))
  File "/sw/lib/python2.2/anydbm.py", line 83, in open
    raise error, "db type could not be determined"
anydbm.error: db type could not be determined

Is this saying that it can not find a database to run on my computer or that the file is not of a database type? Please excuse the ignorance, I'm just now dabbling in databases.

Thanks.
SA


"I can do everything on my Mac that I used to do on my PC, plus alot more ..."

-Me

------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/


---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------