来自大文件的dill.load()会引发EOF错误

时间:2018-03-23 14:18:30

标签: python dill

我试图存储一个直方图列表供以后使用,但我遇到了一个非常大的数据集问题。我有一组大约100,000个直方图,我可以正常加载,但是当我尝试加载第二组(包含500,000~直方图)时,它会抛出一个EOF错误。除了分解数据集之外,还有其他方法可以避免这种情况吗?

我正在保存列表:

file = open("file.txt", "w")
dill.dump(test_list, file)
file.close()

我正在加载列表:

file = open("file.txt", "r")
test_list = dill.load(file)
file.close()

错误:

Traceback (most recent call last):
   File "image.py", line 263, in <module>
      sys.exit(main())
   File "image.py", line 217, in main
        test_list = dill.load(f)
   File "/usr/lib/python2.7/site-packages/dill/dill.py", line 288, in load
        obj = pik.load()
   File "/usr/lib64/python2.7/pickle.py", line 858, in load
        dispatch[key](self)
   File "/usr/lib64/python2.7/pickle.py", line 880, in load_eof
        raise EOFError
EOFError

0 个答案:

没有答案