How can I force python to use dumbdbm module to create a new database? How can I force python to use dumbdbm module to create a new database? unix unix

How can I force python to use dumbdbm module to create a new database?


You cannot control what db module shelve.open uses, but there are workarounds.

The best is usually to create the db yourself and pass it to the Shelf constructor manually, instead of calling shelve.open:

db = dumbdbm.open('mydb')shelf = shelve.Shelf(db)

The first parameter is any object that provides a dict-like interface that can store strings, which is exactly what any *dbm object is.