简体   繁体   English

Python 脚本上的 TestStand 调用可执行步骤引发错误 -17100

[英]TestStand Call Executable Step on Python Script Throws Error -17100

I'm using TestStand 2019, and Python 3.9.我正在使用 TestStand 2019 和 Python 3.9。 Additionally, I'm using a virtual environment created with virtualenv and not venv (because TestStand only works with the former).此外,我使用的是使用 virtualenv 而不是 venv 创建的虚拟环境(因为 TestStand 仅适用于前者)。 The adapter is set to use the Global interpreter, the version is set to 3.9, and I'm pointing to my virtual env directory in the adapter.适配器设置为使用全局解释器,版本设置为 3.9,我在适配器中指向我的虚拟 env 目录。 Additionally, I have ensured that 3.9 is in the Path environment variable.此外,我确保 3.9 在 Path 环境变量中。 I'm using this document as a reference for calling the script:我将此文档用作调用脚本的参考:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x3k0CAA&l=en-US https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x3k0CAA&l=en-US

I've verified that I can call the script from command line, and it operates as expected.我已经验证我可以从命令行调用脚本,并且它按预期运行。 However, if I use the procedure documented above, I receive the following error message from TestStand:但是,如果我使用上面记录的过程,我会从 TestStand 收到以下错误消息:

Run-Time Error:运行时错误:

Details: "[filepath]\my_script.py is not a valid Win32 application."详细信息:“[文件路径]\my_script.py 不是有效的 Win32 应用程序。” (using [filepath]\my_script.py to hide actual names) (使用 [filepath]\my_script.py 隐藏实际名称)

Error Code: "-17100; Incorrect File format."错误代码:“-17100;文件格式不正确。”

I don't know of any means to get more information from TestStand as to the actual cause of the error.我不知道有什么方法可以从 TestStand 获取有关错误实际原因的更多信息。 Originally, I thought it may be because I was passing in arguments into Argument Expression, but calling with an empty string yields the same result.最初,我认为这可能是因为我将 arguments 传递给 Argument Expression,但使用空字符串调用会产生相同的结果。 Any ideas on next steps?关于下一步的任何想法?

Figured it out.弄清楚了。 Was pointing to the Lib/site-packages location of the.py script when I should have been pointing to the.exe in Scripts of my virtual env directory.指向 .py 脚本的 Lib/site-packages 位置,而我应该在我的虚拟 env 目录的脚本中指向 .exe。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM