Popen is no able to process a command that runs in shell

Posted by IceMan85 on Stack Overflow See other posts from Stack Overflow or by IceMan85
Published on 2010-12-22T17:50:31Z Indexed on 2010/12/22 17:54 UTC
Read the original article Hit count: 266

Filed under:
|
|

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:43>ush -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.

© Stack Overflow or respective owner

Related posts about python

Related posts about subprocess