擅长:python、mysql、java
<p>这是因为<code>subprocess.call</code>只返回执行脚本的返回代码(<a href="https://docs.python.org/3/library/subprocess.html" rel="nofollow">documentation</a>)。您需要脚本返回的实际输出,因此应该使用<a href="https://docs.python.org/3/library/subprocess.html#subprocess.check_output" rel="nofollow">check_output</a>,并避免使用<code>shell=True</code></p>
<pre><code>subprocess.check_output(["sudo", "./", config.sh])
</code></pre>
<p>您可能还想通过<code>sudo</code>修改在没有root权限的情况下运行脚本。它看起来不像<em>应该</em>使用root权限运行的东西。你知道吗</p>