Reputation: 81
Proc = subprocess.Popen ([ 'FileName'])
The FileName is a variable which stores "/home/USER/exec.sh &", the program searches for the exec.sh file in the home folder and stores the path in FileName.I am unable to start this exec.sh process.It gives me the following error
OSError: [Errno 2] No such file or directory
I initially used::
os.system(FileName)
It worked perfectly but didn't return the pid. Thus, I switched to Popen.
Upvotes: 0
Views: 47
Reputation: 9065
just:
fileName = "/home/USER/exec.sh"
proc = subprocess.Popen(fileName)
pid = proc.pid
Upvotes: 0