how do we use pytesseract in a node.js server

Viewed 171

I'm using child-process to send an image to a python script in my node.js server. I can read the image in my python script, but once I try to convert it to a text using pytesseract.image_to_string i get this error "error: raise TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: ./Tesseract/tesseract.exe is not installed or it's not in your PATH.". I have already added tesseract-ocr folder to my project, but have the error.

PS: when I try this in a normale js file, it works perfectelly. but in my node.js server it doesn't work!

1 Answers

How did you install tesseract?

The python library appears to be searching for it relative to its relative path.

I suggest that you modify this behavior by telling pytesseract where your executable is located with this property:

pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'

Found here under Usage.

Related