我正在从 macports 运行 python 3.1.4,并尝试在这里使用搁置模块。我可以在另一个开发人员上成功使用它。机器(不同的操作系统等)所以我不确定我可能做错了什么......
任何想法或建议将不胜感激!
这是错误“dbm.error: db type could not be determined”(我搜索了错误消息但没有找到任何信息——我什至试图强制 protocl=2 看看这是否有帮助,但它没有)
下面是互动环节:
Python 3.1.4 (default, Oct 7 2011, 15:58:53)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>> import shelve
>>> a = [1, 2, 3]
>>> locker = shelve.open('myshelf',protocol=2)
>>> locker['a'] = a
>>> locker.close()
>>> exit()
Python 3.1.4 (default, Oct 7 2011, 15:58:53)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>> import shelve
>>> locker = shelve.open('myshelf',protocol=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/shelve.py", line 231, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/shelve.py", line 215, in __init__
Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/dbm/__init__.py", line 84, in open
raise error[0]("db type could not be determined")
dbm.error: db type could not be determined