简体   繁体   English

* nice *在subprocess.call函数不起作用

[英]*nice* in subprocess.call function not working

I tried 我试过了

>>> 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
>>>

I don't understand why subprocess is not recognizing nice there 我不明白为什么子进程在那里不识别

I have no issues running nice in my shell 我跑在我的漂亮的外壳没有任何问题

$nice -n 19 echo 'hi there' $ nice -n 19 echo'hi there'

hi there 嗨,您好

Looks like you forgot an argument with "-n" in your subprocess.call call. 看起来您在subprocess.call调用中忘记了带有"-n"的参数。 You probably meant 你可能是说

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM