From 659d249297cf6b74bcb625c9eef1b52a28a54a61 Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Mon, 4 Nov 2024 11:39:19 +0100 Subject: [PATCH] shuffle around try except and include OSError Fixes #655 --- kraken/lib/arrow_dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kraken/lib/arrow_dataset.py b/kraken/lib/arrow_dataset.py index 310cd0fe0..dd5548462 100644 --- a/kraken/lib/arrow_dataset.py +++ b/kraken/lib/arrow_dataset.py @@ -48,10 +48,10 @@ def _extract_line(xml_record, skip_empty_lines: bool = True, legacy_polygons: bo lines = [] try: im = Image.open(xml_record.imagename) - except (FileNotFoundError, UnidentifiedImageError): - return lines, None, None if is_bitonal(im): im = im.convert('1') + except (OSError, FileNotFoundError, UnidentifiedImageError): + return lines, None, None for idx, rec in enumerate(xml_record.lines): seg = Segmentation(text_direction='horizontal-lr', imagename=xml_record.imagename,