If you go in shell=True, Popen()expect a line:
import subprocess
command = 'python foo.py %s %s | at %s' % (arg1, arg2, starttime)
subprocess.Popen(command, shell=True)
Also, what do you mean by "not working"? This works fine for me:
>>> import subprocess
>>> subprocess.Popen('echo "asd" | rev', shell=True).communicate()
dsa
(None, None)
And your code also:
>>> import subprocess
>>> subprocess.Popen(['echo "asd" | rev',], shell=True).communicate()
dsa
(None, None)
source
share