NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python Modules

Hi,

I am using the TestStand Python Adapters for controlling an Excel Report like this:

 

Zuc_lab2_0-1764600660403.png

 

The problems come to the Error management. I have read that TestStand passes the Containers to python as reference so I have supposed that a dictionary (instead of a tuple) can be a good solution to handle the error. Moreover, I have the same structures for .NET calls where I see this:

 

Zuc_lab2_1-1764600660405.png

 

InitializeSession(UInt32, System.String, System.String, Int32, Boolean ByRef, Int32 ByRef, System.String ByRef)

 

But when I run the my sequence the following error arises:

 

Zuc_lab2_2-1764600660407.png

 

What is the problem?

I have also configured the debugger pointing at the python.exe but I do not go inside the code:

 

Zuc_lab2_3-1764600660408.png

 

 

Is there anyone who has already info on how to share data between python and teststand?

 

Versions: Teststand 2022, Python 3.10

 

Thank you for the help,

 

Zuc

0 Kudos
Message 1 of 2
(181 Views)

In Python, error is typically handled via exceptions. So, for the error scenarios, you can raise exception which will be handled by TestStand. When you raise exception, TestStand will set the status of the step to be Error and also populates the exception message as the error message.

 

While I strongly recommend you to use exceptions for errors, following is my thought on why you might be getting the mentioned error when executing the step:

You mentioned `TestStand passes the Containers to python as reference`. However, this is incorrect. TestStand passes containers as tuple which are immutable object. They are not in/out parameters. In your code, while TestStand is passing the container as tuple, you might be assuming that it is dictionary and hence when you access it via name, you are getting the error. For tuple, you need to access properties via index. 

 

-Shashidhar

0 Kudos
Message 2 of 2
(69 Views)