Python Forum
OSError: [Errno 13] Permission denied - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: OSError: [Errno 13] Permission denied (/thread-12677.html)



OSError: [Errno 13] Permission denied - Kolterdyx - Sep-06-2018

I'm trying to make a little program and i have to run an app called pad.py from another one called tarea1.py but when I try it replies this error:
(Directories are partly in spanish because I'm from Spain)

>>> subprocess.call(["/home/ciro/Escritorio/Programs/Automatic/pad.py"])

Error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/subprocess.py", line 523, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child raise child_exception OSError: [Errno 13] Permission denied
The code of tarea1.py app is this:

import subprocess
import time
import tkinter
import sys
from subprocess import call

password = 'patata'

while True:
	clave = input("Clave de acceso: ")
	if(clave == 'patata'):
		print('Acceso permitido.')
		time.sleep(1)
		subprocess.call(["printf","\033c"])
		subprocess.call(["home/ciro/Escritorio/Programs/Automatic/pad.py", "\033c"])
	else:
		print('Acceso denegado.')
		time.sleep(1)
		print('')
		subprocess.call(["printf", "'\033c'"])
I tried to use os.system() but it didn't work.

I hope someone can help me, please, i didn't find anything in Internet.


RE: OSError: [Errno 13] Permission denied - scidam - Sep-07-2018

1) Check execute permission for pad.py: chmod +x pad.py
2) Don't forget to add a magic line (#!/bin/python or #!/custom/path/to/python/interpreter) to your code (pad.py)...


RE: OSError: [Errno 13] Permission denied - arnavb - Sep-07-2018

As an alternative, you could also prepend the command with python.


RE: OSError: [Errno 13] Permission denied - Gribouillis - Sep-07-2018

(Sep-07-2018, 10:39 AM)arnavb Wrote: As an alternative, you could also prepend the command with python.
Or better, with sys.executable