question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PremissionError: [Errno 13] Permission denied

See original GitHub issue

I am using OSx with python 3.6

Here is my code:

try:
    import Image
except:
    from PIL import Image
import pytesseract

pytesseract.pytesseract.tesseract_cmd = '/usr/local/Cellar/tesseract/3.05.01/'

import cv2

img = cv2.imread('case_2.png')
img = Image.fromarray(img)
print(pytesseract.image_to_string(img, lang='chi_sim'))

But it outputted an error:

Traceback (most recent call last):
  File "/Users/Dylan/Documents/GitHub/Genedock/ocr_framework/tempfyllslkgxc.py", line 13, in <module>
    print(pytesseract.image_to_string(Image.open('case_2.png'), lang='chi_sim'))
  File "/Users/Dylan/anaconda/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 122, in image_to_string
    config=config)
  File "/Users/Dylan/anaconda/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 46, in run_tesseract
    proc = subprocess.Popen(command, stderr=subprocess.PIPE)
  File "/Users/Dylan/anaconda/lib/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/Users/Dylan/anaconda/lib/python3.6/subprocess.py", line 1326, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

I search all of the StackOverflow, but in vain.

So hope you can help me as soon as possible.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

6reactions
int3lcommented, Jul 11, 2017

Your error is on this line: pytesseract.pytesseract.tesseract_cmd = '/usr/local/Cellar/tesseract/3.05.01/'

You should point the tesseract_cmd to the exact path of the tesseract executable and not to the path of the folder where the tesseract executable is located, which is what you did.

Try this line instead: pytesseract.pytesseract.tesseract_cmd = '/usr/local/Cellar/tesseract/3.05.01/tesseract'

Also be sure that you have the tesseract executable inside the folder.

5reactions
int3lcommented, Jul 13, 2017

@diyali03 You can try to issue the following command in order to locate the path of tesseract: which tesseract

Read more comments on GitHub >

github_iconTop Results From Across the Web

PermissionError: [Errno 13] Permission denied - Stack Overflow
This happens if you are trying to open a file, but your path is a folder. This can happen easily by mistake. To...
Read more >
PermissionError: [Errno 13] Permission denied error solved
The error "PermissionError: [Errno 13] Permission denied error" often occurs when the file you are trying to read from or write to is...
Read more >
Python PermissionError: [errno 13] permission denied Solution
The PermissionError: [errno 13] permission denied error occurs when you try to access a file from Python without having the necessary ...
Read more >
Fix - PermissionError: [Errno 13] Permission denied in Python
The python error “PermissionError: [Errno 13] Permission denied” can be fixed in various ways after knowing the root cause.
Read more >
PermissionError: [Errno 13] Permission denied: 'C:\\my\\path ...
You tried to move or replace a file which is open in another application. This is very common in PyInstaller if you open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found