2

I upgraded from python 3.6 to python 3.9 and now the existing gdbm file is not getting read. Following error is being thrown, is there any way to fix this?

Platform: CentOS Linux release 7.9.2009 (Core)

Python: 3.9.9

With Python 3.6 version I created the file in the first place using like this:

self.def_id_seq_map_db = dbm.open(str(self.datapath / "def_id_seq_map"), 'c')
        self.def_id_seq_map = shelve.Shelf(self.def_id_seq_map_db)

The error when I try to read with Python 3.9:

  File "/usr/local/lib/python3.9/dbm/__init__.py", line 91, in open
    raise error[0]("db type is {0}, but the module is not "
dbm.error: db type is dbm.gnu, but the module is not available
P K
  • 69
  • 7
  • What platform are you on (linux [which distro]/mac/windows), and how did you install Python? – larsks Jan 18 '22 at 12:37
  • @larsks Platform: CentOS Linux release 7.9.2009 (Core) Python: 3.9.1. Installed using the following method: wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz && \ tar xzf Python-3.9.9.tgz && \ cd Python-3.9.9 && \ ./configure --enable-optimizations && \ make install – P K Jan 18 '22 at 15:40

1 Answers1

2

It seems you installed Python from sources. You may not have gdbm-devel installed on your system.

What I would try:

  • install gdbm-devel and configure / install python with ./configure --enable-optimizations && \ make install
  • if it do not works, add the following modifier to ./configure script: --with-dbmliborder=gdbm:ndbm
ohe
  • 3,461
  • 3
  • 26
  • 50
  • yes I installed form the sources : wget python.org/ftp/python/3.9.9/Python-3.9.9.tgz && \ tar xzf Python-3.9.9.tgz && \ cd Python-3.9.9 && \ ./configure --enable-optimizations && \ make install – P K Jan 18 '22 at 17:28
  • Thanks @ohe gdbm-devel installation fixed it. – P K Jan 19 '22 at 13:20