NameError: name 'pytesseract' is not defined

8.3k Views Asked by At

Pytesseract is not recognized. I have tried all fixes documented online, including adding Tesseract-OCR to my Path variables, incorporating the pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' command path in my script, uninstalling and reinstalling pytesseract and tesseract.

1

There are 1 best solutions below

0
raza sikander On

In the line 23 vpnbookpassword = pytesseract.image_to_string(pwdi) there you have mentioned pytesseract.image_to_string but you have imported image_to_string from pytesseract import image_to_string and not pytesseract so it could not find pytesseract. So writing it as vpnbookpassword = image_to_string(pwdi) would solve the issue