1

I want to automate some login processes for a ticketing system. There is a simple captcha at the login screen. I am able to take a partial snapshot of it, but as soon as I send that image to image_to_string() function, there is a error. The error says:

"[Win Error 2] The system cannot find the file specified"

The Code

The Error

2
  • I'm not sure why you're getting that error, but why are you saving an image just to open it again in the very next line? Just pass the image directly into tesseract... Commented Jul 8, 2017 at 5:02
  • @Rawing I did that it doesn't help. I am getting the same error. Commented Jul 8, 2017 at 5:07

1 Answer 1

2

The problem here is not that tesseract can't find your image, it's that Windows can't find tesseract.

pytesseract internally runs subprocess.Popen(['tesseract', input_file]), and this throws the error. But if you try subprocess.Popen(['tesseract']), you'll get the exact same error.

If you read the installation instructions you'll see:

You must be able to invoke the tesseract command as tesseract.

And:

If this isn't the case, for example because tesseract isn't in your PATH, you will have to change the "tesseract_cmd" variable at the top of tesseract.py

So you can either add tesseract to your PATH or modify the tesseract_cmd to point directly to your tesseract executable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.