subprocess.Popen: 'OSError: [Errno 13] Permission denied' only on Linux
This is the executable you are trying to run:
-rw-rw-r-- 1 travis travis 276306 Sep 29 20:14 espeak
Its permissions are rw-
read+write for owner (travis), rw-
read+write for group (travis), and r--
read for others. There is no permission to execute for anyone.
You have to give x
(execute) permission to the user under which the script is running. Or give it to everyone:
chmod 775 espeak
After that, ls- l
should say:
-rwxrwxr-x 1 travis travis 276306 Sep 29 20:14 espeak
I have an Errno 13 Permission denied with subprocess in python
The error indicates that /usr/share/java
does not have permissions that will allow you to execute it, probably because it is a directory, not an executable.
Find the location of the java
executable on your Ubuntu machine (probably /usr/bin/java
) and change /usr/share/
to point to the right place.
What permissions are required for subprocess.Popen?
It seems the 'Permissions denied error' was orginally coming from Popen trying to execute mdb-export from the wrong location (and to compound things, with the wrong permissions).
If mdbtools is installed, the following works fine and inherits the correct permissions without the need for sudo etc.
subprocess.Popen(("mdb-export", mdb.name, tbl,),stdout=csv)
(Worth noting, I got myself into a muddle for a while, having forgotten that Popen is for opening executables, not folders or non-exectable files in folders)
Thanks for all your responses, they all made for interesting reading regardless :)
PermissionError: [Errno 13] Permission denied and Subprocess error
Looks like you're trying to execute the file named yadt/dTcmd
, but it's not marked executable. Add the execute permission (for all users) like this:
chmod a+x yadt/dTcmd
Linux Server/Python: OSError: [Errno 13] Permission denied
TLDR; run chmod 744
in the directory with your Python script.
You don't have the correct permissions for the directory in which you are attempting to create the folder. From the same directory where you have fileCreator.py, run ls -la .
on the command line and it will output something like this:
drwxr-xr-x 9 user staff 306 Oct 9 21:29 .
drwxr-xr-x+ 36 user staff 1224 Sep 28 12:26 ..
-rw-r--r-- 1 user staff 977 Oct 9 21:04 .bashrc
And probably a bunch of other files. The first line is the current directory. user
is your login and staff
is the group that owns it. They will be different on your system. The drwxr-xr-x
is the permissions, and they are changed by the chmod
command.
Check out more about Linux permissions here: https://www.linux.com/learn/understanding-linux-file-permissions
Python CGIHTTPServer crashes with OSError: [Errno 13] Permission denied
Are you, by any chance, running the process as root?
If you use the source, you will see in CGIHTTPServer.py
, just before calling execve
:
try:
os.setuid(nobody)
except os.error:
pass
That is, it will run the CGI script as nobody, if it is able to change the UID, that is if it is root. If it is not root, this call will most likely fail, and pass on.
So my guess is that you are running the server as root, so the script is run as nobody, but this user doesn't have access to the script. Which is expected, as you say that it is in your home dir.
Two solutions that I can think of:
- The recommended: do not run the server as root!
- The workaround: copy the script to a directory where nobody can read it (
/tmp
for example).
subprocess.Popen: 'OSError: [Errno 2] No such file or directory' only on Linux
The Linux binary packaged with the repo is not compatible with the Travis Build Architecture and the binary needs t be built from source before it is executed.
Instructions for buiding:
https://github.com/rhdunn/espeak#building-1
Related Topics
How to Limit the Amount of Time a Function Can Run for (Add a Timeout)
Auto Executable Python File Without Opening from Terminal
Sharing Psycopg2/Libpq Connections Across Processes
How to Split My 800X480 5-Inch Screen into 2 Parts
Modulenotfounderror: No Module Named 'Pydip', Although It's Installed
Launch Default Image Viewer from Pygtk Program
Faster Way to Find Large Files with Python
How to Send Input on Stdin to a Python Script Defined Inside a Makefile
Virtualenv Uses Wrong Python, Even Though It Is First in $Path
Importerror: No Module Named 'Pysqlite2'
How to Get an Windows Executable from My Kivy App (Pyinstaller)
Listening for Global Key-Combinations in Python on Linux
Frequency Counts for Unique Values in a Numpy Array
Writing Python Lists to Columns in Csv