12-01-2025 08:54 AM
Hi,
I am using the TestStand Python Adapters for controlling an Excel Report like this:
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:
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:
What is the problem?
I have also configured the debugger pointing at the python.exe but I do not go inside the code:
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
12-23-2025 11:10 PM
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