catch OSError when reading image
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user