NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python script (some) called from TS does not work

Solved!
Go to solution

Now I have a *.py file, and it contains many functions that I have already wroten and tested. next step I want to call the functions from TestStand, and analyze the results. How can I tranfer the parameters between python function and TestStand Locals or Parameters?

0 Kudos
Message 1 of 5
(3,987 Views)

Hey,

 

How are you calling your python script from TestStand? Are you using the Python Step Types or are you building an executable and calling that from TestStand? What is the current issue that you are seeing? 

 

If you're using the Python Step Types, the mapping between Python data types and TestStand data types is as following:

 

image.png

This is also outlined in the Python Step Types in TestStand help. 

 

0 Kudos
Message 2 of 5
(3,963 Views)
Solution
Accepted by topic author XingCao

Thanks a lot for the reply.

 

I only have the licence for NI Software Pack 2012, so still stuggle with the TestStand 2012, namely using Call-executable steps in TestStand. I read the doc "calling scripts from teststand..." and tried the example in Web, I am guessing that only Strings can be transferred between TestStand and Python .py files, is that correct?

 

I have experience calling VIs from TestStand, but recently I wanted to intergrate Python with TestStand and got no examples showing how to do this. When I try to return some parameters from Python Fcn, how can I get its value in TestStand, especially Python List and Dict? 

 

In the file attached, I already have many Fcns wrotten. How can i use it in my TestStand Sequence file without save them separetely into many .py files and not only can use the print method  to trans the String Paramters, but also return method or other method to trans Python List and Dict? 

looking forward for the reply, Thanks.

 

0 Kudos
Message 3 of 5
(3,956 Views)
Solution
Accepted by topic author XingCao

It is not possible to do what you are asking to do. Yes, you can only pass ASCII characters with the Standard In and Out, so you would have to develop an interface for your python code that could serialize the dictionary object that you're passing between TestStand 2012 and your module. This is essentially what we have implemented for our custom python step types that support TestStand 2014 and later. 

0 Kudos
Message 4 of 5
(3,934 Views)

Thank you again for the reply. In the end, with the help of Python "import re module", I have realised my goal, but not so convinient. I will also try TestStand 2014 or later with the TS python module and figure out whether it works.

0 Kudos
Message 5 of 5
(3,867 Views)