claw107
claw107

Reputation: 81

Subprocess.Popen error

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

Answers (1)

armnotstrong
armnotstrong

Reputation: 9065

just:

fileName = "/home/USER/exec.sh"
proc = subprocess.Popen(fileName)
pid = proc.pid

Upvotes: 0

Related Questions