intra2net/guibot

issues with spaces in tesseract datapath

Closed this issue · 0 comments

On windows I experienced that in cases where the tesseract datapath is set with a path containing spaces (such as C:\Program Files\Tesseract-OCR\ ) the following error occurs:

Traceback (most recent call last):
  File "X:\Arbeit\GuiBot Playground\main.py", line 23, in <module>
    obj = gb.find('test.steps')
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\guibot\region.py", line 425, in find
    found_pics = cv_backend.find(target, screen_capture)
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\guibot\finder.py", line 3166, in find
    matches = matcher.find(step_needle, haystack)
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\guibot\finder.py", line 2201, in find
    output = self.ocr.image_to_string(text_img,
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\pytesseract\pytesseract.py", line 423, in image_to_string
    return {
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\pytesseract\pytesseract.py", line 426, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\pytesseract\pytesseract.py", line 288, in run_and_get_output
    run_tesseract(**kwargs)
  File "X:\Arbeit\GuiBot Playground\venv\lib\site-packages\pytesseract\pytesseract.py", line 264, in run_tesseract
    raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:Program/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')