I'm coming across a sh: 1: permission denied error while running a python script (both with and without sudo),

enter image description here

but can't seem to resolve it using chmod or chown on the relevant directories and the script itself. Is there something I'm missing?

As seen in below, I have all the read/write/execute rights and ownership of the relevant directories and script (train.py and tesseract directory), but still get permission denied.

enter image description here

I'm new to linux (currently using Ubuntu 16.04), and have tried googling on this problem for the past couple of days to no avail, any help would be greatly appreciated!

  • Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you. In particular, it is not terribly clear which parts of the script in question is failing, or even what they are trying to do when they fail. Commented Jan 24, 2017 at 6:25
  • 3
    In general we frown upon screenshots, they are not searchable, and therefore encourage you to transcribe the text. The error message refers to /usr/local/src/tesseract as a program to execute, but your text shows it is a directory.
    – icarus
    Commented Jan 24, 2017 at 6:32

1 Answer 1


From your first screenshot (don't post images of text), it looks as if you are using /usr/local/src/tesseract as a command, but from the second screenshot it's clear that this is a directory.

Your Python script train.py probably needs updating with the proper path to the tesseract executable (which I presume must live somewhere within the /usr/local/src/tesseract dierctory).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .