diff --git a/worthless/installer.py b/worthless/installer.py index 17213ba..358c7ec 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -492,7 +492,10 @@ class Installer: contents = await pkg_version.read_text() async def calculate_md5(file_to_calculate): - async with AsyncPath(file_to_calculate).open("rb") as f: + file_to_calculate = AsyncPath(file_to_calculate) + if not await file_to_calculate.exists(): + return "" + async with file_to_calculate.open("rb") as f: file_hash = hashlib.md5() while chunk := await f.read(self._download_chunk): file_hash.update(chunk)