Tag Archives: Pyteseract identification verification code Error

How to Solve Pyteseract identification verification code Error

Run py files report the error:

pytesseract.pytesseract.TesseractError: (1, ‘Error opening data file \\Program Files\\Tesseract-OCR\\tessdata/eng.traineddata’)

Specify tessdata_dir in the py file

testdata_dir_config = '--tessdata-dir "C:\\Program Files\\Tesseract-OCR\\tessdata"'
textCode = pytesseract.image_to_string(img, config=testdata_dir_config)

Problem solving

This error is reported

Filenotfounderror: [winerror 2] the system cannot find the specified file

Modify the testseract in the pytestseract.py file_cmd

tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

Done!