Reputation: 2375
I am running a python test framework that uses Tesseract.
When I run a test that uses tesseract however I get the following error :
WindowsError: [Error 2] The system cannot find the file specified
I managed to go through the logs and found it breaks at:
File "C:\Python27\lib\subprocess.py", line 212, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "C:\Python27\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
startupinfo)
The subprocess is called by a non python lib command from the framework
def process_frame_text(single_char=False):
tess_list = ['tesseract', 'tmp/ocr_image.png', 'tmp/ocr_output']
tess_list += ['-psm', '10'] if single_char else []
check_output(tess_list, stderr=STDOUT)[:-1]
I have installed windows Tesseract on my machine at C:\Program Files x86\Tesseract-OCR
Appreciate you ideas.
Thanks
Upvotes: 0
Views: 2555
Reputation: 8626
Apparently, subprocess
module is not able to find tesseract.exe
and invoke it from Windows shell. If path to the executable, C:\Program Files x86\Tesseract-OCR
, is not added to Windows environment variables
, then modify tess_list
to provide full file path.
EDIT:
For your case, should set:
TESSDATA_PREFIX
= C:\Program Files x86\Tesseract\tessdata
that points to the trained language data files. C:\Program Files (x86)\Tesseract-OCR
which is the tesseract.exe
file path should be added to Windows system PATH
variable as an addition value, such as
PATH=%PATH%;"C:\Program Files (x86)\Tesseract-OCR"
if added by
command for temporary use. Upvotes: 5