From 1e288100a96315ff1fa4de2be7872fa42e68502c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Mon, 21 Feb 2022 22:58:19 +0100 Subject: [PATCH] Remove unneded exception handler from has_alpha() --- src/paperless_tesseract/parsers.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/paperless_tesseract/parsers.py b/src/paperless_tesseract/parsers.py index 02de914ce..c1eddcefe 100644 --- a/src/paperless_tesseract/parsers.py +++ b/src/paperless_tesseract/parsers.py @@ -67,14 +67,8 @@ class RasterisedDocumentParser(DocumentParser): ] def has_alpha(self, image): - try: - with Image.open(image) as im: - return im.mode in ('RGBA', 'LA') - except Exception as e: - self.log( - 'warning', - f"Error while check for alpha channel in image {image}: {e}") - return None + with Image.open(image) as im: + return im.mode in ('RGBA', 'LA') def get_dpi(self, image): try: