I am trying to use pytesseract's run_and_get_output function . But it is giving me :
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\yp270\\AppData\\Local\\Temp\\tess_0va90z8x.'
I am using: python 3.7.5 pytesseract 0.3.1 tesseract 3.05.02
I have tried : setting TESSDATA_PREFIX to my tessdata directory in system environment variables setting pytesseract.pytesseract.tesseract_cmd to my tesseract executable file
I seems the error comes when pytesseract is trying to open some output file File "C:\\Users\\yp270\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pytesseract\\pytesseract.py", line 260, in run_and_get_output
File "C:\\Users\\yp270\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pytesseract\\pytesseract.py", line 260, in
with open(filename, 'rb') as output_file:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\yp270\\AppData\\Local\\Temp\\tess_5nau69o0.'
But, apart from all this , their is no problem while using image_to_string , image_to_data , image_to_osd etc functions. They work perfectly fine. this problem arises only in run_and_get_output function.
Can anyone tell where is the problem???
Code:
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:\\Users\\yp270\\AppData\\Local\\Tesseract-OCR\\tesseract.exe'
from PIL import Image
img = Image.open('image_path')
boxes = pytesseract.image(img)
Have you tried installing a different version of Tesseract? I got the same error as you while using tesseract v5.0.0, but everything worked fine after switching to tesseract v4.0.0.
I used tesseract-ocr-w64-setup-v4.0.0.20181030.exe from the older versions section at https://github.com/UB-Mannheim/tesseract/wiki
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.