Don't hide OCR errors by doing a fallback try without language option. gh-issue #211
This commit is contained in:
@@ -26,11 +26,8 @@ class Tesseract(OCRBackendBase):
|
|||||||
# If tesseract gives an error with a language parameter
|
# If tesseract gives an error with a language parameter
|
||||||
# re-run it with no language parameter
|
# re-run it with no language parameter
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
logger.error('Exception calling pytesseract with language option: %s; %s', self.language, exception)
|
error_message = 'Exception calling pytesseract with language option: {}; {}'.format(self.language, exception)
|
||||||
try:
|
logger.error(error_message)
|
||||||
result = pytesseract.image_to_string(image=image)
|
raise OCRError(error_message)
|
||||||
except Exception as exception:
|
|
||||||
logger.debug('Exception calling pytesseract without a language option; %s', exception)
|
|
||||||
raise OCRError
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user