1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-09-18 12:32:21 +00:00

Add an option to force the load of shelf plugins

Closes gsi-upm/senpy#34
This commit is contained in:
J. Fernando Sánchez
2017-05-17 16:25:13 +02:00
parent f76b777b9f
commit ea91e3e4a4
4 changed files with 47 additions and 5 deletions

View File

@@ -98,8 +98,10 @@ class ShelfMixin(object):
if os.path.isfile(self.shelf_file):
try:
self.__dict__['_sh'] = pickle.load(open(self.shelf_file, 'rb'))
except EOFError:
logger.warning('corrupted shelf file!')
except (EOFError, pickle.UnpicklingError):
logger.warning('{} has a corrupted shelf file!'.format(self.id))
if not self.get('force_shelf', False):
raise
return self._sh
@sh.deleter