WinError 5: access denied by PyTesseract

I know this question has already been given on this site, however, none of the solutions I searched on the Internet seems to work. Here is what I tried:

  • Granting all permissions for my python file
  • Changing the PATH variable to point to my tesseract folder
  • Running IDLE as administrator and then executing this file

This mistake bothers me now, and I can’t move on.

Here is my code if this helps:

import pytesseract
import sys
import argparse
try:
    import Image
except ImportError:
    from PIL import Image
from subprocess import check_output
pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files\Tesseract-OCR'
c=pytesseract.image_to_string(Image.open('img.png'))
print(c)

Traceback:

Traceback (most recent call last):
  File "C:\Users\Hp\Desktop\bot.py", line 12, in <module>
    c=pytesseract.image_to_string(Image.open('captcha.png'))
  File "C:\Python\lib\site-packages\pytesseract\pytesseract.py", line 122, in image_to_string
config=config)
  File "C:\Python\lib\site-packages\pytesseract\pytesseract.py", line 46, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
  File "C:\Python\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
  File "C:\Python\lib\subprocess.py", line 992, in _execute_child
startupinfo)
PermissionError: [WinError 5] Accès refusé
+6
source share
1 answer

I suspect a few things, but not sure about that.

, Tesseract . - :

tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract'

, /, , . , , -, , .

+3

All Articles