pytesseract: windows 10 :pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata')
I am using pytesseract on windows 10 x64, and the python is 3.5.2
x64, Tesseract is 4.0
,the code is as follow:
# -*- coding: utf-8 -*-
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))
error:
Traceback (most recent call last):
File "D:/test.py", line 10, in <module>
print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))
File "C:\Users\dell\AppData\Local\Programs\Python\Python35\lib\site-packages\pytesseract\pytesseract.py", line 165, in image_to_string
raise TesseractError(status, errors)
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata')
C:\Program Files (x86)\Tesseract-OCR\tessdata
,like this:
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 30 (3 by maintainers)
@zwl1619, @coollorenzo, Finally managed to reproduce this error.
Please try to use the config option with pytesseract like this:
If this workaround works for you, I will include the snippet to the README file.
This occurs under windows (at least in tesseract version 3.05) when the current directory is on a different drive from where tesseract is installed.
Something in tesseract is expecting data files to be in \Program Files… (rather than C:\Program Files, say). So if you’re not on the same drive letter as tesseract, it will fail. It would be great if we could work around it by temporarily changing drives (under windows only) to the tesseract installation drive before executing tesseract, and changing back after.
Hi, I added the following lineto my python code and it works
pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files (x86)\Tesseract-OCR\\tesseract.exe'
You have to install Tesseract-OCR first (https://digi.bib.uni-mannheim.de/tesseract/).Same problem here using windows 10 64bit and python2.7 32bit
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\tesseract-ocr\\tessdata/eng.traineddata')
@int3l This issue not user error like #55. The error occurs in tesseract itself:
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/eng.traineddata')
It can be worked around by changing directory to the drive containing tesseract, but not by customizing
pytesseract.pytesseract.tesseract_cmd
unfortunately.I was facing something similar. The problem was on the version of tesseract. I was trying to use a 32bit version. Getting the right version (for 64bit) here: (https://digi.bib.uni-mannheim.de/tesseract/). Instaling and seting up TESS_DATA path was the soluiton! Now it is running smooth! thanks for the link @mhalomari!