3
votes

Evening everyone,

I am trying to use a tesseract (OCR) python wrapper found here, with the first example: https://code.google.com/p/python-tesseract/wiki/CodeSnippets

I am using Python27, on a Windows XP machine. Everything is 32 bit.

I have installed all the dependencies, found in this guide: http://opencvpython.blogspot.com/2012/05/install-opencv-in-windows-for-python.html

I checked the environment variable: TESSDATA_PREFIX = C:\Program Files\Tesseract-OCR\tessdata\

Then finally, I try to execute the script in cmd.exe: "python.exe 119.py" (119.py being the first example in CodeSnippets, with a different image ofc), and I get the following error:

C:\Python27>python.exe 119.py Error opening data file C:\Program Files\Tesseract-OCR\tessdatatessdata/eng.trai neddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent d irectory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages!

Now, the only thing I notice here is the slash (/) instead of backslash (\) before the eng.traineddata, that's the bit automatically added after the environment variable. I am hoping this is the only thing that needs fixing, but I have no clue on how to do it, and that is why I am here... :)

So, seasoned programmers, binary Gods, please help me out. Thanks in advance. :)

p.s.

I need to be using a Windows machine for this project, so swiching to Linux as an easy way out is not an option here. :(

1
The error message tells you not to include the tessdata directory in the path and displays a path with "tessdatatessdata" - its obviously appending the path again. Try removing it from the path. - tdelaney
Omg am I this worn out... Ok, yes, obviously... Now I just keep getting python crashes after execution, but I get some output (though wrong)... Thanks for the input, can't believe I was this careless... -.- - cab00t
p.s. How do I up vote you on a comment? :)) - cab00t

1 Answers

0
votes

I got the same error and after i set it via this command in cmd, it accepted.

set TESSDATA_PREFIX=C:/Program Files (x86)/Tesseract-OCR/tessdata

you need to use forward slash even windows accepts backslash.