windows 10 :pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata')
See original GitHub issueI 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:
Issue Analytics
- State:
- Created 7 years ago
- Comments:25
Top Results From Across the Web
Pytesseract: Error opening data file \\Program Files (x86) ...
Finally, I solved the problem by replacing. pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'.
Read more >Issue 568 in tesseract-ocr: error opening data file
in cmd I run tesseract cn test the cmd display error opening data file eng.traineddata. I think it's the file separator issue, how...
Read more >pytesseract
Add the following config, if you have tessdata error like: “Error opening data file…” # Example config: r'--tessdata-dir "C:\Program Files (x86)\Tesseract-OCR\ ...
Read more >How to upload new .traineddata file in pytesseract ...
TesseractError : (1, 'Tesseract Open Source OCR Engine v3.04.01 with Leptonica Error opening data file /usr/share/tesseract-ocr/tessdata/ocr.
Read more >Problems with Tesseract OCR : r/learnmachinelearning
Error opening data file \\Program Files\\Tesseract-OCR\\tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.