Open Shelf File

I am trying to find the "key" in "my.db". I have done the following:

import shelve db_file = os.path.join(self.path_data, 'my_directory', 'my.db') s = shelve.open(db_file) val = s["key"] 

and I get this error:

  /opt/Python-2.4.3/lib/python2.4/shelve.py in open(filename='/path_here/dir/netmhcpan.db', flag='c', protocol=None, writeback=False, binary=None) /opt/Python-2.4.3/lib/python2.4/shelve.py in __init__(self=<DbfilenameShelf instance>, filename='/path_here/dir/netmhcpan.db', flag='c', protocol=None, writeback=False, binary=None) /opt/Python-2.4.3/lib/python2.4/anydbm.py in open(file='/path_here/dir/netmhcpan.db', flag='c', mode=438) ...... ImportError: No module named _bsddb args = ('No module named _bsddb',) 

Appreciate any help to resolve this issue. Thanks.

+2
source share
1 answer

Install db4-devel or the like, and then rebuild Python.

+2
source

Source: https://habr.com/ru/post/1212333/


All Articles