0
from PIL import Image
import pytesseract
im = Image.open("news.jpg")

text = pytesseract.image_to_string(im, lang='eng')

print(text)

So the code above throws this error:

Traceback (most recent call last):                                                              
  File "C:\Users\test\Documents\Projects\TesseractTest\main.py", line 6, in <module>            
    text = pytesseract.image_to_string(im, lang='eng')                                          
  File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 122, in image_to_string 
    config=config)                                                                              
  File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 46, in run_tesseract    
    proc = subprocess.Popen(command, stderr=subprocess.PIPE)                                    
  File "C:\Python27\lib\subprocess.py", line 711, in __init__                                   
    errread, errwrite)                                                                          
  File "C:\Python27\lib\subprocess.py", line 959, in _execute_child                             
    startupinfo)                                                                                
WindowsError: [Error 2] The system cannot find the file specified   

The news.jpg is present and I'm running this on windows 10.

Thanks, Ed.

Ed Lynch
  • 615
  • 4
  • 10
  • 28

0 Answers0