From 605f5bcd6a449420f9833171997839cf4c41533c Mon Sep 17 00:00:00 2001 From: Miguel Astor Date: Sun, 30 Jul 2023 19:11:22 -0400 Subject: [PATCH] Championship style exception handling. --- viewer/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/viewer/utils.py b/viewer/utils.py index e09faf8..40c6cdc 100644 --- a/viewer/utils.py +++ b/viewer/utils.py @@ -30,6 +30,9 @@ def make_thumbnail(image): thumb_path.parent.mkdir(parents = True, exist_ok = True) if not thumb_path.exists(): - with Image.open(str(image)) as pilimg: - pilimg.thumbnail(THUMB_SIZE) - pilimg.save(str(thumb_path)) + try: + with Image.open(str(image)) as pilimg: + pilimg.thumbnail(THUMB_SIZE) + pilimg.save(str(thumb_path)) + except: + pass