在unpickle上键入错误

时间:2013-03-24 12:32:38

标签: python pickle typeerror

我有一本字典被腌成文件“offsets.pickle”。当我尝试用

取消它时
import pickle
a = open('offsets.pickle')
b = pickle.load(a)

我收到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/global/python-2.7.3-intel/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/usr/global/python-2.7.3-intel/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/global/python-2.7.3-intel/lib/python2.7/pickle.py", line 1198, in load_setitem
    dict[key] = value
TypeError: 'str' object does not support item assignment

我的代码每晚运行一段时间都运行良好,突然之间就开始发生这种情况了。我可以恢复存储在文件中的内容吗?

0 个答案:

没有答案