Cryptic TesseractError (-9) when processing image
Created by: jmgilman
Using the latest version of pyocr and attempting to parse text on a file run through unpaper:
with open('test.unpaper.pnm', 'r') as f:
text = ocr.image_to_string(f, lang='eng')
Is causing the follow stacktrace:
File "/usr/local/lib/python3.5/dist-packages/pyocr/tesseract.py", line 358, in image_to_string
raise TesseractError(status, errors)
pyocr.error.TesseractError: (-9, b'Tesseract Open Source OCR Engine v3.04.01 with Leptonica\n')
However, I can run the following command:
tesseract test.unpaper.pnm output
And it works without errors. After searching, I cannot find any reference to the -9 return value, and it seems like the error output is being truncated (it's just the top stdout when you first run Tesseract).
Suggestions?