Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionError: [WinError 5] Access is denied - python - pytesseract.image_to_string #568

Open
jaydattpatel opened this issue Mar 1, 2024 · 0 comments

Comments

@jaydattpatel
Copy link

I tried to run image to string convert program in python using pytesseract. I am using VS code with Jupyter Extension and Python 3.12.0 installed. I am facing error in pytesseract.image_to_string......

`from PIL import Image

import pytesseract

pytesseract.pytesseract.tesseract_cmd = r'C:\Users\KP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytesseract'

image = Image.open("readonly/text.png")

text = pytesseract.image_to_string(image)
print(text)


PermissionError Traceback (most recent call last)
c:\Users\KP\Downloads\Python Project pillow, tesseract, and opencv\Week-2\Jupitor files\module_2.ipynb Cell 9 line 2
1 # One last thing to mention - the image_to_string() function takes in an "image", but the docs don't
2 # really describe what this image is underneath. Is it a string to an image file? A PILLOW image?
3 # Something else?
(...)
27 #
28 # Ok, lets try and run tesseract on this image
---> 29 text = pytesseract.image_to_string(image)
30 print(text)

File c:\Users\KP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytesseract\pytesseract.py:423, in image_to_string(image, lang, config, nice, output_type, timeout)
418 """
419 Returns the result of a Tesseract OCR run on the provided image to string
420 """
421 args = [image, 'txt', lang, config, nice, timeout]
--> 423 return {
424 Output.BYTES: lambda: run_and_get_output(*(args + [True])),
425 Output.DICT: lambda: {'text': run_and_get_output(*args)},
426 Output.STRING: lambda: run_and_get_output(*args),
427 }output_type

File c:\Users\KP\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytesseract\pytesseract.py:426, in image_to_string..()
418 """
...
898 cmd_line = patch_arg_str_win(cmd_line)
899 send_process_created_message()
--> 901 return getattr(_subprocess, original_name)(app_name, cmd_line, *args)

PermissionError: [WinError 5] Access is denied`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant