0
我在使用我的dev服務器上擱置時遇到問題。當我調用shelve.open()時,我的本地機器會創建一個新文件。但是,當我將文件推送到遠程服務器時,會發生錯誤。看起來它試圖首先找到該文件,並且因爲它不在那裏而失敗。我沒有改變文件擴展名。我的本地機器是Ubuntu 14,我的遠程機器是CentOS 6.這裏是python堆棧跟蹤。 Python 2.6。Shelve.open創建失敗
File "/var/lib/jenkins/................/translation.py", line 51, in _market
lang_db = shelve.open(market + "_pydb")
File "/usr/lib64/python2.6/shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/lib64/python2.6/shelve.py", line 223, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/usr/lib64/python2.6/anydbm.py", line 83, in open
return mod.open(file, flag, mode)
File "/usr/lib64/python2.6/dbhash.py", line 19, in open
return bsddb.hashopen(file, flag, mode)
File "/usr/lib64/python2.6/bsddb/__init__.py", line 361, in hashopen
d.open(file, db.DB_HASH, flags, mode)
DBNoSuchFileError: (2, 'No such file or directory')
爲了記錄,我將默認值更改爲dumbdbm,它仍然給我一個IO錯誤(未找到文件)。
import anydbm
anydbm._defaultmod = __import__('dumbdbm')