0

So I was trying to run some code using pytesseract, and I got this error:

 raise TesseractNotFoundError()

TesseractNotFoundError: tesseract is not installed or it's not in your path

There was a post on this site that provided the solution, I added it to my code and it fixed things:

pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe"

However, I want to understand what exactly this line of code is doing as I don't understand? It looks like it is calling a method on the pytesseract library? I don't understand, is this a line of code that can work with any library? What does the "r" in front of the path of the program file do?

paul23
  • 8,799
  • 12
  • 66
  • 149
Jed Bartlet
  • 1,963
  • 2
  • 11
  • 12
  • 1
    The first part, no, it's not a method that can work on any library. It looks like a method that tells the `pytesseract` library where it look in order to launch an executable for a CLI. I'm not familiar with the library, but this method will have been built specifically by the creators of this package, it's not not something general to python. – roganjosh Sep 18 '18 at 17:08
  • @roganjosh is right. Pytesseract is, in fact, a wrapper around tesseract.exe, so you need to install tesseract first & set path to the executable. You can also add the tesseract.exe path to the `PATH` variable. – Dmitrii Z. Sep 18 '18 at 17:30

0 Answers0