diff --git a/src/simsopt/mhd/vmec.py b/src/simsopt/mhd/vmec.py index 94af6cc98..507c8c9a7 100644 --- a/src/simsopt/mhd/vmec.py +++ b/src/simsopt/mhd/vmec.py @@ -752,7 +752,11 @@ def run(self): # Delete the previous output file, if desired: for filename in self.files_to_delete: - os.remove(filename) + try: + os.remove(filename) + except FileNotFoundError: + logger.debug(f"Tried to delete the file {filename} but it was not found") + self.files_to_delete = [] # Record the latest output file to delete if we run again: