0

我有一本被腌制到文件“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

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

4

0 回答 0