kel-z/HSR-Scanner

TesseractError while trying any type of scan

Closed this issue · 2 comments

[FATAL] > Scan aborted with error TesseractError: (1, 'Error opening data file C:\Program Files\Tesseract-OCR/DIN-Alternate.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'DIN-Alternate' Tesseract couldn't load any languages! Could not initialize tesseract.')

Stack trace: "Traceback (most recent call last):
File "main.py", line 581, in run
File "asyncio\runners.py", line 44, in run
File "asyncio\base_events.py", line 646, in run_until_complete
File "services\scanner\scanner.py", line 125, in start_scan
File "services\scanner\scanner.py", line 231, in scan_inventory
File "utils\ocr.py", line 40, in image_to_string
File "pytesseract\pytesseract.py", line 423, in image_to_string
File "pytesseract\pytesseract.py", line 426, in
File "pytesseract\pytesseract.py", line 288, in run_and_get_output
File "pytesseract\pytesseract.py", line 264, in run_tesseract
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\Program Files\Tesseract-OCR/DIN-Alternate.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'DIN-Alternate' Tesseract couldn't load any languages! Could not initialize tesseract.')

Confirmed the systen env variable C:\Program Files\Tesseract-OCR\tessdata is set correctly, but there is no /DIN-Alternate.traineddata file under tessdata.

Ah shoot, I didn't account for the case where TESSDATA_PREFIX is already set on the system. I'll fix this soon. For now, try deleting the environment variable and run it again.