python - Pytesseract No such file or directory error -
first of did mentioned here pytesseract-no such file or directory error
still doesn't work. i'm using pycharm ide following code:
from pil import image import pytesseract import subprocess im = image.open('test.png') im.show() subprocess.call(['tesseract','test.png','out']) print pytesseract.image_to_string(image.open('test.png'))
- im.show() opens image successfully.
- subprocess.call() tesseract test.png out extracts text image..
- but pytesseract.image_to_string() fails.
i don't it. why able use tesseract in shell not in python. , in python can open same image when used tesseract image can't found.
below can see error output.
file "/home/hamza-c/schreibtisch/android/jioshare/orc.py", line 7, in <module> print pytesseract.image_to_string(image.open('/home/hamza-c/schreibtisch/android/jioshare/test.png')) file "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 162, in image_to_string config=config) file "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 95, in run_tesseract stderr=subprocess.pipe) file "/usr/lib/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1340, in _execute_child raise child_exception oserror: [errno 2] no such file or directory
i tested code mentioned in question. works fine. facing same error
no such file or directory found
the problem directory containing 'tesseract.exe' not added environment variable. should able run command 'tesseract' in command prompt.
if tesseract not installed can download tesseract 1: https://github.com/tesseract-ocr/tesseract/wiki , windows use third party installer available here
Comments
Post a Comment