From 8396cf5e60197076c21b2425cb90a3ccc1cdc7d1 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 20 Apr 2024 17:01:36 +1200 Subject: [PATCH] TimeoutError when using pytesseract --- app/activitypub/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 685db364..d8e74a04 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -863,6 +863,8 @@ def make_image_sizes_async(file_id, thumbnail_width, medium_width, directory): 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: + 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() notification = Notification(title='Review this',