Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Migrate from os.rename to shutil.move
Browse files Browse the repository at this point in the history
`os.rename` is brittle and prone to failure. Among other things, it struggles with moving files between mount points. Something that's required if you have docker volumes. Should also address dbr#154
  • Loading branch information
mcclurec authored Nov 18, 2019
1 parent f5a9060 commit 58da871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tvnamer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def delete_file(fpath):
def rename_file(old, new):
p("rename %s to %s" % (old, new))
stat = os.stat(old)
os.rename(old, new)
shutil.move(old, new)
try:
os.utime(new, (stat.st_atime, stat.st_mtime))
except OSError as ex:
Expand Down

0 comments on commit 58da871

Please sign in to comment.