Commit abf441b1 authored by Jerome Flesch's avatar Jerome Flesch

Box builders must work even if Tesseract is not installed --> psm_parameter()...

Box builders must work even if Tesseract is not installed --> psm_parameter() must also work if Tesseract is not installed
parent 3fd92201
......@@ -159,8 +159,16 @@ def can_detect_orientation():
def psm_parameter():
"""Return the psm option string depending on the Tesseract version."""
version = get_version()
return "--psm" if version[0] > 3 else "-psm"
try:
version = get_version()
return "--psm" if version[0] > 3 else "-psm"
except Exception as exc:
logger.warning(
"psm_parameter(): failed to get Tesseract version. Assuming"
"Tesseract >= 4 --> using option '--psm'",
exc_info=exc
)
return "--psm"
def detect_orientation(image, lang=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment