I'm trying to run this python code, but it keeps throwing the same error. I'm using pytesseract on a windows machine (coding in pycharm) to scan an image. I made a project on cloud9 that haevily used pytesseract in amazon web services and everything worked fine I am convinced that this is a windows problem. This is all in python 2.7 (this is a small test program I made to debug this same problem in a much bigger project)
Here's my code:
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
filename = "Z:\Pycharm Projects\IBM-Waldon-master\screenshots\image.png"
print pytesseract.image_to_string(Image.open(filename))
I've tried making the meat of the code a function and restarting my computer but it still throws this error:
Z:\Python27\interpeter\Scripts\python.exe "Z:/Pycharm Projects/IBM-Waldon-
master/testest.py"
Traceback (most recent call last):
File "Z:/Pycharm Projects/IBM-Waldon-master/testest.py", line 9, in <module>
print pytesseract.image_to_string(Image.open(filename))
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "Z:\Python27\Lib\subprocess.py", line 394, in __init__
errread, errwrite)
File "Z:\Python27\Lib\subprocess.py", line 644, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Process finished with exit code 1