My program was killed while serializing data (a dict
) to disk with dill
. I cannot open the partially-written file now.
Is it possible to partially or fully recover the data? If so, how?
Here's what I've tried:
>>> dill.load(open(filename, 'rb'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lib/python3.4/site-packages/dill/dill.py", line 288, in load
obj = pik.load()
EOFError: Ran out of input
>>>
The file is not empty:
>>> os.stat(filename).st_size
31110059
Note: all data in the dictionary was comprised of python built-in types.
dill
author. Indeed, pickling is just dumping to a string, so you should be able to recover up to the last object dumped when it failed.pickle
and thusdill
pickles recursively, so be warned that the "last object" means "the last object that was the target of adump
". – Jaimiejain