Skip to content

Commit

Permalink
SDK: Fix FileExistsErrors on Windows when a dataset is loaded from …
Browse files Browse the repository at this point in the history
…cache

`atomic_writer` is supposed to overwrite the destination file, but
`os.rename` doesn't do that on Windows. We have to use `os.replace` instead.
  • Loading branch information
SpecLad committed Aug 21, 2023
1 parent 5889c43 commit dd862f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cvat-sdk/cvat_sdk/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def atomic_writer(
try:
with tmp_file:
yield tmp_file
os.rename(tmp_path, path)
os.replace(tmp_path, path)
except:
os.unlink(tmp_path)
raise

0 comments on commit dd862f2

Please sign in to comment.