1
0
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:
Ian Wood 2017-05-16 15:09:46 +01:00
parent 13cefbedfb
commit f76b777b9f

View File

@ -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