2013-10-24 45 views
0

我試圖*在subprocess.call功能很好*不工作

>>> import subprocess 
>>> import os 
>>> subprocess.call(["echo","Hello there"], env=os.environ) 
Hello there 
0 
>>> subprocess.call(["nice", "19", "echo","Hello there"], env=os.environ) 
nice: 19: No such file or directory 
127 
>>> subprocess.call(["nice", "19", "echo","Hello there"], env=os.environ, shell=True) 
0 
0 
>>> 

我不明白爲什麼子是不承認不錯

我跑在不錯沒有問題我外殼

$不錯-n 19回聲 '您好'

hi there

回答

1

看起來你忘記了"-n"在你的subprocess.call調用中的一個參數。你的意思可能是

subprocess.call(["nice", "-n", "19", "echo", "Hello there"], env=os.environ) 
相關問題