From 487b73011783aa202efa41ec870482b31e20b1b6 Mon Sep 17 00:00:00 2001 From: quackerd Date: Wed, 30 Sep 2020 15:43:58 -0400 Subject: [PATCH] ignore same file error --- musick.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/musick.py b/musick.py index d5b6d89..791cd4c 100644 --- a/musick.py +++ b/musick.py @@ -141,7 +141,10 @@ def process_file(f: str, odir: str): os.makedirs(target_dir, exist_ok = True) target_f = os.path.join(target_dir, os.path.basename(f)) - shutil.copyfile(f, target_f) + try: + shutil.copyfile(f, target_f) + except shutil.SameFileError: + pass print(" Copied file to - " + target_f) cover_idx = find_best_cover(artist, album, title)