pytesseract not working [closed]
Matthew Barrera
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from PIL import Image
>>> import pytesseract
>>> i=Image.open("C:\Users\dharaneeshvrd\Desktop\img.jpgSyntaxError: EOL while scanning string literal
>>> i=Image.open("C:\Users\dharaneeshvrd\Desktop\img.jpg")
>>> print pytesseract.image_to_string(i)Traceback (most recent call last): File "", line 1, in print pytesseract.image_to_string(i) File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 161, in image_to_string config=config) File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 94, in run_tesseract stderr=subprocess.PIPE) File "C:\Python27\lib\subprocess.py", line 390, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 640, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified
>
What i have done wrong here? I have installed the pytesseract using pip as
pip install pytesseractand pillow as
pip install pillow 0 1 Answer
As specified in the error:
The system cannot find the file specified
The filename - C:\Users\dharaneeshvrd\Desktop\img.jpg - is in-correct (or doesn't exists).
Assuming that you are running on Ubuntu, the file name format should be different.
I'd suggest first, identifying the file in your drive and second, issue:
ls -lsa /full/path/nameto make sure that you wrote the path correctly, and afterwards use it in the python script