如何使用 python 到 运行 测试台序列
How to use python to run a teststand sequence
我有一个 python 脚本 运行 作为 windows 服务。它会自动将最新代码下载到我的硬件中。然后我还想使用 "Teststand scripts" 自动测试硬件。
如何将我的 python 脚本转换为 运行 Teststand 序列,然后自动将结果通过电子邮件发送给我;最好甚至不打开 gui?
如果我只是从命令提示符调用 Teststand 文件,它会打开 gui,要求我登录,我仍然必须按 运行。我需要这一切都在幕后处理。
您可以通过命令提示符执行此操作。因此,如果您想从 python 调用它,请使用 subprocess 模块。
import os
import subprocess
os.chdir("C:\Program Files (x86)\National Instruments\TestStand 2013\Bin")
subprocess.Popen(['SeqEdit.exe', '/runEntryPoint', 'Single Pass',...
'C:\pathtofile\myteststandfile.seq', '/quit'])
这里的关键是参数。
'/运行EntryPoint' 和 'Single Pass' 强制它自己 运行 文件。
'/quit' 显然会在完成后将其关闭。
如果没有任何东西阻碍您的测试,这将启动测试台,运行 测试,保存报告,并自行关闭测试台。
我有一个 python 脚本 运行 作为 windows 服务。它会自动将最新代码下载到我的硬件中。然后我还想使用 "Teststand scripts" 自动测试硬件。
如何将我的 python 脚本转换为 运行 Teststand 序列,然后自动将结果通过电子邮件发送给我;最好甚至不打开 gui?
如果我只是从命令提示符调用 Teststand 文件,它会打开 gui,要求我登录,我仍然必须按 运行。我需要这一切都在幕后处理。
您可以通过命令提示符执行此操作。因此,如果您想从 python 调用它,请使用 subprocess 模块。
import os
import subprocess
os.chdir("C:\Program Files (x86)\National Instruments\TestStand 2013\Bin")
subprocess.Popen(['SeqEdit.exe', '/runEntryPoint', 'Single Pass',...
'C:\pathtofile\myteststandfile.seq', '/quit'])
这里的关键是参数。 '/运行EntryPoint' 和 'Single Pass' 强制它自己 运行 文件。 '/quit' 显然会在完成后将其关闭。 如果没有任何东西阻碍您的测试,这将启动测试台,运行 测试,保存报告,并自行关闭测试台。