shelve db type could not be determined, whichdb is not recognizing gdb

我怕爱的太早我们不能终老 提交于 2019-12-01 12:29:19

As explained on the question this error was due to a bug in whichdb that is not able to identify some newest gdb files, more information is on this bug report: https://bugs.python.org/issue13007

The best solution is to force the db defining a method that load the shelve with gdbm instead of trying to guess the dbm.

def gdbm_shelve(filename, flag="c"):
    mod = __import__("gdbm")
    return shelve.Shelf(mod.open(filename, flag))

And then use it instead of shelve.open:

info_file = gdbm_shelve(info_file_name)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!