Popen is no able to process a command that runs in shell
- by IceMan85
Hello everybody, I have already read the previous questions posted on the same argument but I really haven't figured it out yet.
I am trying to run a command that works without issues from the command line :
xyz@klm:~/python-remoteWorkspace/PyLogParser/src:18:43ush
-o PPP -p PRD -n log 'pwd' 6:43PM
PPP:prd:lgsprdppp:/ama/log/PRD/ppp
but when I do the same in python I always get errors :
stringa = Popen(["ush -o PPP -p PRD -n
log 'pwd'"], stdout=PIPE,
stdin=PIPE).communicate()[0]
Here the error.
Traceback (most recent call last):
File "getStatData.py", line 134, in
retrieveListOfFiles(infoToRetList) File "getStatData.py", line 120, in
retrieveListOfFiles
stringa = Popen(["ush -o PPP -p PRD -n log 'pwd'"], stdout=PIPE,
stdin=PIPE).communicate()[0] File
"/opt/python-2.6-64/lib/python2.6/subprocess.py",
line 595, in init
errread, errwrite) File "/opt/python-2.6-64/lib/python2.6/subprocess.py",
line 1092, in _execute_child
raise child_exception OSError: [Errno 2] No such file or directory
I've tried also different solutions like
stringa = Popen(["ush", "-o", "PPP", "-p" "PRD", "-n", "log", '"pwd"'], stdout=PIPE, stdin=PIPE).communicate()[0]
but nothing seems to work. I have also tried to put the absolute path to ush but nothing...
Can somebody please explain me what am I doing wrong ?
Thanks in advance, AM.