Skip to content

Commit a7f270f

Browse files
Add additional fallback...
1 parent 2dba7e2 commit a7f270f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

diplomat/predictors/sfpe/file_io.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,11 @@ def commit(self):
614614
# Windows does some weird stuff here... We fallback to the 'unsafe' option...
615615
try:
616616
os.remove(self._final_path)
617-
except FileNotFoundError:
618-
pass
619-
os.rename(self._commiter_path, self._final_path)
617+
os.rename(self._commiter_path, self._final_path)
618+
except (FileNotFoundError, PermissionError) as e:
619+
print(f"Unable to remove the file due to {e}")
620+
shutil.copyfile(self._commiter_path, self._final_path)
621+
620622

621623
# Reset edit info...
622624
self._last_flush = time.monotonic()

0 commit comments

Comments
 (0)