Commit 4df6e03f authored by Alan Taylor's avatar Alan Taylor

catch file unpickling and related errors

parent 967553ab
......@@ -104,9 +104,12 @@ def _data_read(filename):
--------------------------------------------------------------------------
"""
with open(filename, 'rb') as infile:
restored_progress = pickle.load(infile)
return restored_progress
try:
restored_progress = pickle.load(infile)
except (pickle.UnpicklingError, AttributeError, EOFError, ImportError, IndexError):
sys.exit('exiting: problem reading data from ' + filename)
else:
return restored_progress
# wrappers for _data_read
benchmark_cache_read = functools.partial(_data_read, filename=ds.FILENAME_BENCHMARK_CACHE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment