You mix two different Popen calls. Any of them will work:
proc=subprocess.Popen(['/bin/echo', 'hello', 'world'], shell=False, stdout=subprocess.PIPE)
or
proc=subprocess.Popen('echo hello world', shell=True, stdout=subprocess.PIPE)
When passing shell = True, the first argument is the string — the shell command line. If you do not use a wrapper, the first argument is a list. Both produce this:
print proc.communicate() ('hello world\n', None)
Wexxor
source share