我需要多次调用一个脚本,但参数不同。参数存储在argument_list及其字符串列表中。
for argument in argument_list: python_command = "python another_script.py --server " + argument p = Popen(python_command,shell=True, stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate()
有人知道为什么会这样,我该怎么解决?谢谢你的建议。
python_command = "python another_script.py --server " + argument
Popen的参数必须按顺序排列:
python_command = ["python", "another_script.py", "--server", argument]
还有一个建议:试着把Popen语句放在 try ... except
try ... except