mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-22 08:12:27 +00:00
don't fail if shelf pickle file broken
This commit is contained in:
parent
13cefbedfb
commit
f76b777b9f
@ -96,7 +96,10 @@ class ShelfMixin(object):
|
|||||||
if not hasattr(self, '_sh') or self._sh is None:
|
if not hasattr(self, '_sh') or self._sh is None:
|
||||||
self.__dict__['_sh'] = {}
|
self.__dict__['_sh'] = {}
|
||||||
if os.path.isfile(self.shelf_file):
|
if os.path.isfile(self.shelf_file):
|
||||||
self.__dict__['_sh'] = pickle.load(open(self.shelf_file, 'rb'))
|
try:
|
||||||
|
self.__dict__['_sh'] = pickle.load(open(self.shelf_file, 'rb'))
|
||||||
|
except EOFError:
|
||||||
|
logger.warning('corrupted shelf file!')
|
||||||
return self._sh
|
return self._sh
|
||||||
|
|
||||||
@sh.deleter
|
@sh.deleter
|
||||||
|
Loading…
Reference in New Issue
Block a user