From 35efd7725ce06162f89eba0d84996d50734e73e9 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 20 Apr 2024 20:17:58 +1200 Subject: [PATCH] Tesseract errors take many forms - just capture them all in one go --- app/activitypub/util.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 09def318..9aa0bca2 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -867,9 +867,7 @@ def make_image_sizes_async(file_id, thumbnail_width, medium_width, directory): if img_width < 2000: # images > 2000px tend to be real photos instead of 4chan screenshots. try: image_text = pytesseract.image_to_string(Image.open(BytesIO(source_image)).convert('L'), timeout=30) - except FileNotFoundError as e: - image_text = '' - except TimeoutError as e: + except Exception as e: image_text = '' if 'Anonymous' in image_text and ('No.' in image_text or ' N0' in image_text): # chan posts usually contain the text 'Anonymous' and ' No.12345' post = Post.query.filter_by(image_id=file.id).first()