簡體   English   中英

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

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

我試過了

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

我不明白為什么子進程在那里不識別

我跑在我的漂亮的外殼沒有任何問題

$ nice -n 19 echo'hi there'

嗨,您好

看起來您在subprocess.call調用中忘記了帶有"-n"的參數。 你可能是說

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