Testing some rudimentary error handling in download_library to look at issue #57

This commit is contained in:
64Core 2022-06-08 21:26:16 -05:00
parent c0075c9d01
commit 0dded2ab02

View file

@ -83,10 +83,20 @@ class Library:
lock = threading.RLock()
def dl(i, g):
x = g.download(self.login, platform)
with lock:
i[0] += 1
print(f"Downloaded {g.name} ({i[0]} of {l})")
return x
try:
x = g.download(self.login, platform)
except:
with lock:
with open("errors.txt", "a") as f:
f.write(
f""" Cannot download game/asset: {g.name}
This game/asset has been skipped please download manually
---------------------------------------------------------\n """
)
finally:
with lock:
i[0] += 1
print(f"Downloaded {g.name} ({i[0]} of {l})")
return x
executor.map(functools.partial(dl, i), self.games)