bsddb.error

Romuald Texier rtexier at elikya.com
Tue Apr 24 03:58:56 EDT 2001


Mark blobby Robinson wrote:

> Hi Romuald,
> 
> thanks for the advice. Can you tell me how to force shelve to use gbd or
> direct me to any documentation. I am have to admit I am a bit of newbie
> both to python and linux, so sorry for being a pain in the arse.

To be honest, the last time I did it, I was so irritated that I just 
removed the bsddb module from my system... It is quite a brute force way 
(shame on me).

In fact, the shelve open() function uses anydbm which has a quite funny 
behavior sometimes...

If you want to use another DB you have to instatiate yourself the Shelf 
class with a dictionary like object (a hash of a DB) :

>>> from shelve import Shelf
>>> import gdbm
>>> db = gdbm.open("myDB.db", "c")
>>> objdb = Shelf(db)
>>> l = [1,6,7]
>>> objdb['l'] = l
>>> objdb.close() 

You use objdb as you usually do with shelve.




-- 
Romuald Texier



More information about the Python-list mailing list