【发布时间】:2018-02-15 11:41:34
【问题描述】:
我正在尝试运行 PowerShell 脚本 test_me.ps1,它需要 3 个参数:-Name name、-Age age、-Place place。
input_data 是我从 pytest 传递的内容。
这是我的代码:
try:
output = subprocess.call(
[
"powershell.exe",
"-Name" + input_data['name'],
"-Age" + input_data['age'],
"Place" + input_data['place']
], '&{. "./test_me.ps1"}')
except subprocess.CalledProcessError, e:
print "subprocess CalledProcessError.output = " + e.output
print output
我想检查输出。
【问题讨论】:
-
你期望什么输出?你得到了什么?如果您没有发现错误并可能隐藏部分错误,您会得到什么?
-
在 PowerShell 中运行 test_me.ps1 的输出是什么?
标签: python python-2.7 powershell subprocess