catch OSError when reading image

This commit is contained in:
Maciej Budyś
2022-02-18 21:36:17 +01:00
parent 96cbb50e87
commit 5fb6504c74

View File

@@ -107,8 +107,9 @@ def run(read_from='clipboard',
try: try:
img = Image.open(path) img = Image.open(path)
except UnidentifiedImageError: img.load()
logger.warning(f'Error while reading file {path}') except (UnidentifiedImageError, OSError) as e:
logger.warning(f'Error while reading file {path}: {e}')
else: else:
process_and_write_results(mocr, img, write_to) process_and_write_results(mocr, img, write_to)