Skip to content

Commit

Permalink
shuffle around try except and include OSError
Browse files Browse the repository at this point in the history
Fixes #655
  • Loading branch information
mittagessen committed Nov 4, 2024
1 parent 9540c18 commit 659d249
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kraken/lib/arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 659d249

Please sign in to comment.