Skip to content Skip to sidebar Skip to footer

Annoying Python Tesseract Error Error Opening Data File ./tessdata/eng.traineddata

I'm bumping into this error that's driving me a little bit crazy with the python wrapper for tesseract which is a python module called tesseract. Here's the python code I am trying

Solution 1:

The first parameter to api.Init should be TESSDATA_PREFIX.


Solution 2:

get location of ur tessdata folder by typing in command prompt: 
$ brew list tesseract
in may case:
/usr/local/Cellar/tesseract/3.05.01/bin/tesseract
/usr/local/Cellar/tesseract/3.05.01/include/tesseract/ (27 files)
/usr/local/Cellar/tesseract/3.05.01/lib/libtesseract.3.dylib
/usr/local/Cellar/tesseract/3.05.01/lib/pkgconfig/tesseract.pc
/usr/local/Cellar/tesseract/3.05.01/lib/ (2 other files)
/usr/local/Cellar/tesseract/3.05.01/share/man/ (11 files)
/usr/local/Cellar/tesseract/3.05.01/share/tessdata/ (28 files)

now
tessdata_dir_config = r'--tessdata-dir "/usr/local/Cellar/tesseract/3.05.01/share/tessdata"'

txt= image_to_string(img,lang='eng',config=tessdata_dir_config)

Post a Comment for "Annoying Python Tesseract Error Error Opening Data File ./tessdata/eng.traineddata"