ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

NI TestStand

取消
显示结果 
搜索替代 
您的意思是: 

Exchange data with TestStand from a python thread

Hello all,

 

I have a Python script, running continously in a thread, to be launched by TestStand. I also need to have a TestStand Thread to get information from this python script, without stopping it.

 

So my question is :

- How can I exchange data from Python to TestStand asynchronously?

 

Why I expect :

- Have a method to put data in a TestStand Queue from Python. The Python script will call this method each time it receive a data.

- Pool this queue in TestStand (WaitForEvent?) and manage the sequence depending on the datas.

 

Regards,

pl75

0 项奖励
1 条消息(共 14 条)
8,924 次查看

I just happened upon this tutorial.

 

Hope it helps.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 项奖励
2 条消息(共 14 条)
8,876 次查看

 

 

Thank you,

 

 

Thank you,

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

 

Thank you,

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

It means, not by stdout, but by a TestStand API.  

Thank you,

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

It means, not by stdout, but by a TestStand API.

 

Regards,

pl.

 

 

 

Thank you,

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

It means, not by stdout, but by a TestStand API.

 

Regards,

pl.

 

 

 

0 项奖励
3 条消息(共 14 条)
8,868 次查看

Thank you,

Thank you,

 

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

Thank you,

 

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

It means, not by stdout, but by a TestStand API.

Thank you,

 

 

This tutorial does not include what I need :

- Passing data, during run time, from Python to TestStand without exiting my Python script.

 

It means, not by stdout, but by a TestStand API.

 

Regards,

pl.

0 项奖励
4 条消息(共 14 条)
8,860 次查看

I'm not that familiar with python. Does it support calling into COM APIs? If so then it should be possible to pass a COM reference for something like the SequenceContext and it could then programmatically access the data. Perhaps IronPython, based on .NET, could do this when called from the .NET adapter or .NET code module.

 

Hope this helps,

-Doug

0 项奖励
5 条消息(共 14 条)
8,848 次查看

You can use the Python for Windows extensions (http://sourceforge.net/projects/pywin32/) and use code like the following to create and Engine:

 

 

import win32com.client

tsApp = win32com.client.Dispatch("TestStand.Engine.1")
print "TestStand %s.%s ready" % (tsApp.MajorVersion, tsApp.MinorVersion)
Hope that helps

 

6 条消息(共 14 条)
8,828 次查看

Has anyone gotten this to work? The  below two lines of code return a "Class Not Registered Error". I also tried using "TS.iEngine" as the class string, since this is what LabVIEW seems to tall the Teststand engine. In that case, I get "Invalid Class String. I am able to open a reference to Excel without any problems by replaceing "Teststand.Engine.1" with "Excel".

 

Do I need to explicitly register the Teststand Engine with Windows? Or is there an additional "Import" I need in the python code?

 

import win32com.client
tsApp = win32com.client.Dispatch("Teststand.Engine.1")

0 项奖励
7 条消息(共 14 条)
8,132 次查看

It definitely works for me. You have to make sure that the COM Server is registered (you can use version selector to do that). You can also use ActiveXHelper (http://www.nirsoft.net/utils/axhelper.html) to make sure that the server is registered and to get the server name (search for the file description "TestStand OLE API Library")

0 项奖励
8 条消息(共 14 条)
8,127 次查看

Thanks for the reply! The problem turned out to be that I had 64-bit python installed. I installed the 32-bit versions of python and pywin, and now it works fine.

9 条消息(共 14 条)
8,110 次查看

Anyone have example python code for passing a sequence context from Teststand to PyWin via the TS API?

0 项奖励
10 条消息(共 14 条)
8,083 次查看