pytesseract: Can't access Image with "Image.open" "Errno 2" error

Viewed 4447

I'm trying to use pytesseract for the first time. I'm also not so confortable with python. I've created a new folder called python_test on my desktop. I'm on Mac. In this folder I have a test.png file and a py script :

from pytesseract import image_to_string
from PIL import Image

print image_to_string(Image.open('test.png'))
print image_to_string(Image.open('test-english.jpg'), lang='eng')

So from my terminal, I'm going into the python_test folder then I'm running python read.py then I have the following error :

Traceback (most recent call last):
  File "read.py", line 4, in <module>
    print image_to_string(Image.open('test.png'))
  File "/anaconda/anaconda/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string
    config=config)
  File "/anaconda/anaconda/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract
    stderr=subprocess.PIPE)
  File "/anaconda/anaconda/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/anaconda/anaconda/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

What I'am doing wrong ?

2 Answers
Related