Skip to content

Commit

Permalink
fix shutil.SameFileError while moving reference log
Browse files Browse the repository at this point in the history
  • Loading branch information
Maritsu committed Jul 11, 2024
1 parent 796b578 commit 73a1298
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spotify_dl/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ def download_songs(**kwargs):
log.debug("Downloading to %s", url["save_path"])
reference_file = DOWNLOAD_LIST
track_db = write_tracks(reference_file, kwargs["songs"])
shutil.copy(reference_file, kwargs["output_dir"] + "/" + reference_file)
os.remove(reference_file)
if not shutil._samefile(reference_file, kwargs["output_dir"] + "/" + reference_file):
shutil.copy(reference_file, kwargs["output_dir"] + "/" + reference_file)
os.remove(reference_file)
reference_file = str(kwargs["output_dir"]) + "/" + reference_file
kwargs["reference_file"] = reference_file
kwargs["track_db"] = track_db
Expand Down

0 comments on commit 73a1298

Please sign in to comment.