diff --git a/brian_polling_manager/configuration.py b/brian_polling_manager/configuration.py index 160b07dcbe8870351dc5a27b418ca4dc91a108d8..ae43058178763c9d3a0af344f57b9d27accb9c6a 100644 --- a/brian_polling_manager/configuration.py +++ b/brian_polling_manager/configuration.py @@ -210,7 +210,12 @@ class State(object): @last.setter def last(self, new_last: Union[float, None]): if not new_last or new_last < 0: - os.unlink(self.cache_filenames['state']) + try: + os.unlink(self.cache_filenames['state']) + except OSError: + logger.exception( + f'unable to delete state file {self.cache_filenames["state"]}') + return else: State._save_json( self.cache_filenames['state'],