Python Forum

Full Version: OSError: [Errno 13] Permission denied
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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)...
As an alternative, you could also prepend the command with python.
(Sep-07-2018, 10:39 AM)arnavb Wrote: [ -> ]As an alternative, you could also prepend the command with python.
Or better, with sys.executable