I keep getting PermissionError: [WinError 5] Access is denied on Pytesserect

Viewed 26

I know this has been answered but nothing works, I run my code

import pytesseract
import cv2
pytesseract.pytesseract.tesseract_cmd = r"C:\\Users\\aidan\\AppData\\Local\\Tesseract-OCR"
image = cv2.imread(r'C:\Users\aidan\OneDrive\Desktop\download.jpg')
cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(image))
cv2.imshow('Result',image)
cv2.waitKey()

and I always get this error

[ WARN:0@0.043] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('download.jpg'): can't open/read file: check file path/integrity
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied

how can I fix this?

1 Answers

You have dropped the executable in the cmd-variable:

pytesseract.pytesseract.tesseract_cmd = r"C:\Users\aidan\AppData\Local\Tesseract-OCR\tesseract.exe"
Related