diff --git a/fsl/data/image.py b/fsl/data/image.py index 7c2bdbcba722e8f0017ce0bba46269283f8e4d8b..0dbd331af452c1e2c23beeaca7a4ea2b77c29672 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -1206,7 +1206,8 @@ class Image(Nifti): def __del__(self): """Closes any open file handles, and clears some references. """ - Nifti.__del__(self) + if Nifti is not None: + Nifti.__del__(self) self.__nibImage = None self.__imageWrapper = None diff --git a/fsl/utils/settings.py b/fsl/utils/settings.py index ceeb6bfe9060f6f8db8f28987869bc84e22628fc..523caddc184f0f88b9f4069cbcab1f32ba3c7e11 100644 --- a/fsl/utils/settings.py +++ b/fsl/utils/settings.py @@ -421,7 +421,7 @@ class Settings(object): try: with open(configFile, 'wb') as f: pickle.dump(config, f, protocol=2) - except (IOError, pickle.PicklingError, EOFError): + except (IOError, pickle.PicklingError, EOFError, FileNotFoundError): log.warning('Unable to save {} configuration file ' '{}'.format(self.__configID, configFile), exc_info=True)