File permissions issue under Windows fixed

Under Windows while using the `--overwrite` option files would refuse to be overwritten, this is now fixed by first removing the file then renaming it.
master
Anthony Forsberg 2017-05-23 13:53:56 -04:00
parent ff13704c83
commit a2ad7439c2
1 changed files with 5 additions and 1 deletions

View File

@ -234,6 +234,10 @@ class BandcampDownloader:
audio["date"] = meta["date"]
audio.save()
os.rename(filepath, filepath[:-4])
try:
os.rename(filepath, filepath[:-4])
except WindowsError:
os.remove(filepath[:-4])
os.rename(filepath, filepath[:-4])
sys.stdout.write("\r({}/{}) [{}] :: Finished: {}".format(self.track_num, self.num_tracks, "=" * 50, filename))