Hi
I am having problems using subprocess.Popen.
Here is a small script I have written
from subprocess import Popen
import os
global p
def executeProcess():
cmd = "ls -l /home"
global p
p = Popen(cmd)
#os.system (cmd)
This works only once in a while. I keep getting the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kkj/CNU/LINUX/bin/Runtime/CNUSubprocess.py", line 10, in executeProcess
p = Popen(cmd)
File "/usr/lib/python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1051, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
It works if I use os.system, but I want to use Popen
Also how can I run a bash script like "source" using Popen ? I tried :
os.system (" source .../cshrc")
and I got error messages like setenv : command not found.
Can someone tell me what I'm missing?