From a3bea6633d0c826cd8ffd833f3bf0ff0c72000b0 Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Fri, 8 Sep 2023 14:11:36 +0200 Subject: [PATCH] more exception catching --- cat_win/cat.py | 2 +- cat_win/util/zipviewer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cat_win/cat.py b/cat_win/cat.py index b523128e..2dc1f625 100644 --- a/cat_win/cat.py +++ b/cat_win/cat.py @@ -718,7 +718,7 @@ def edit_file(file_index: int = 0) -> None: except PermissionError: err_print(f"Permission denied! Skipping {holder.files[file_index].displayname} ...") return - except BlockingIOError: + except (BlockingIOError, FileNotFoundError): err_print('Resource blocked/unavailable! Skipping ' + \ f"{holder.files[file_index].displayname} ...") return diff --git a/cat_win/util/zipviewer.py b/cat_win/util/zipviewer.py index e94b4910..030d05eb 100644 --- a/cat_win/util/zipviewer.py +++ b/cat_win/util/zipviewer.py @@ -31,5 +31,5 @@ def display_zip(file: str, size_converter) -> bool: print(f"{name.ljust(length_list[0])} " + \ f"{size.rjust(length_list[1])} {csize.rjust(length_list[2])}") return True - except zipfile.BadZipfile: + except (zipfile.BadZipfile, OSError): return False