Skip to content
Snippets Groups Projects
Commit ea4f821b authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

MNT: Prevent errors at GC (Image), and when files are removed before

atexit (settings)
parent 12c92a62
No related branches found
No related tags found
No related merge requests found
...@@ -1206,7 +1206,8 @@ class Image(Nifti): ...@@ -1206,7 +1206,8 @@ class Image(Nifti):
def __del__(self): def __del__(self):
"""Closes any open file handles, and clears some references. """ """Closes any open file handles, and clears some references. """
Nifti.__del__(self) if Nifti is not None:
Nifti.__del__(self)
self.__nibImage = None self.__nibImage = None
self.__imageWrapper = None self.__imageWrapper = None
......
...@@ -421,7 +421,7 @@ class Settings(object): ...@@ -421,7 +421,7 @@ class Settings(object):
try: try:
with open(configFile, 'wb') as f: with open(configFile, 'wb') as f:
pickle.dump(config, f, protocol=2) pickle.dump(config, f, protocol=2)
except (IOError, pickle.PicklingError, EOFError): except (IOError, pickle.PicklingError, EOFError, FileNotFoundError):
log.warning('Unable to save {} configuration file ' log.warning('Unable to save {} configuration file '
'{}'.format(self.__configID, configFile), '{}'.format(self.__configID, configFile),
exc_info=True) exc_info=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment