0
votes
> import image 
> import pytesseract as pya
> 
> pya.tesseract_cmd = r'C:\Users\Euphz\Documents\Artworks\PSD\Speaking
of Dogs\201710'
> print(pya.image_to_string(image.open('doggieville.png')))

Traceback (most recent call last): File "C:\PythonProjects\pytesseract.py", line 2, in import pytesseract as pya File "C:\PythonProjects\pytesseract.py", line 5, in print(pya.image_to_string(image.open('doggieville.png'))) AttributeError: module 'pytesseract' has no attribute 'image_to_string'

Why is it happening???

2

2 Answers

7
votes

The problem is, you have to rename the python file to something else instead of pytesseract.py . Your python file has the same name as tesseract inbuilt function .

1
votes

Can you try this?

import image 
import pytesseract as pya

pya.tesseract_cmd = r'C:\Users\Euphz\Documents\Artworks\PSD\Speaking
of Dogs\201710'
print(pya.image_to_string(image.open('doggieville.png')))

The import statements need to be in seperate lines.