相关疑难解决方法(0)

subprocess:意外关键字参数capture_output

当执行Python文档中subprocess.run()给出的时,我得到一个TypeError:

>>> import subprocess
>>> subprocess.run(["ls", "-l", "/dev/null"], capture_output=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
Run Code Online (Sandbox Code Playgroud)

我正在运行Python 3.6.6:

$ python3 --version
Python 3.6.6
Run Code Online (Sandbox Code Playgroud)

python subprocess

37
推荐指数
2
解决办法
9899
查看次数

标签 统计

python ×1

subprocess ×1