diff options
| author | Cody Logan <cody@lokken.dev> | 2023-10-24 13:31:12 -0700 |
|---|---|---|
| committer | Cody Logan <cody@lokken.dev> | 2023-10-24 13:31:12 -0700 |
| commit | 2ea4fc946474ae0d0f3d0b21184f2e025bad7736 (patch) | |
| tree | 2f2497890f56737bcef6250b1b3df3700a64167f | |
| parent | d972bc113f60a7602c7078914dcc03a84401bbf1 (diff) | |
| download | wikiget-2ea4fc946474ae0d0f3d0b21184f2e025bad7736.tar.gz wikiget-2ea4fc946474ae0d0f3d0b21184f2e025bad7736.zip | |
Catch possible OS errors when verifying download
| -rw-r--r-- | src/wikiget/dl.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py index 5213863..93e9743 100644 --- a/src/wikiget/dl.py +++ b/src/wikiget/dl.py @@ -140,7 +140,14 @@ def download(f: File, args: Namespace) -> int: progress_bar.update(len(chunk)) # verify file integrity and log details - dl_sha1 = verify_hash(dest) + try: + dl_sha1 = verify_hash(dest) + except OSError as e: + adapter.error( + f"File downloaded but could not be verified. {e}" + ) + errors += 1 + return errors adapter.info(f"Remote file SHA1 is {file_sha1}") adapter.info(f"Local file SHA1 is {dl_sha1}") |
