use os.path.join
All checks were successful
dl / lint (push) Successful in 1m28s
dl / docker (push) Successful in 45s

This commit is contained in:
Michel Roux 2023-10-02 11:57:11 +02:00
parent a41f88d6b6
commit bd7d25ff97

View File

@ -38,7 +38,7 @@ def download(path, file):
) )
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
print(f"Removing {path}/{file}") print(f"Removing {path}/{file}")
os.remove(f"{path}/{file}") os.remove(os.path.join(path, file))
print("Waiting for 10 minutes ...") print("Waiting for 10 minutes ...")
time.sleep(10 * 60) time.sleep(10 * 60)
download(path, file) download(path, file)
@ -78,11 +78,11 @@ def remove(path):
to_remove = [] to_remove = []
for name in os.listdir(path): for name in os.listdir(path):
if os.path.isfile(f"{path}/{name}"): if os.path.isfile(os.path.join(path, name)):
id = get_title_shortid(name) id = get_title_shortid(name)
if not id: if not id:
to_remove.append(f"{path}/{name}") to_remove.append(os.path.join(path, name))
if len(to_remove) > 100: if len(to_remove) > 100:
print("Too much to delete:") print("Too much to delete:")