Python Call Parameters

The Python Adapter converts data between TestStand and Python when calling functions or using attributes in Python. The table below contains the mapping of data types between TestStand and Python.

TestStand Python 2.7 Python 3.6+ Notes
Floating Point Number float float

Python has infinite precision for numeric data types. When converting the numeric types from Python to TestStand, data loss may occur due to overflow or underflow of a numeric value.

TestStand passes numeric constants to Python using the default float type for the constant. If you want to pass numeric constants to Python as integers, change the numeric representation of constants by using the expression function Int64() or UInt64() .

Signed 64 Number long int
Unsigned 64 Number long int
Enum (Floating Point Representation) float enum TestStand passes enums to Python modules as Python enums only if you specify a type mapping for the TestStand enum. Otherwise, TestStand passes enums to Python modules as numbers.
Enum (Signed 64 Representation) long enum
Enum (Unsigned 64 Representation) long enum
Boolean bool bool
String str str
Container tuple tuple
Array (Excluding Array of Numbers) list list The type of array elements in a Python list depends on the type of array elements in TestStand. For example, Array of Strings in TestStand maps to a list of strings in Python.
Array of Numbers list or NumPy array list or NumPy array

You must install the NumPy module to pass an array of numbers from TestStand to Python as a NumPy array.

TestStand passes an array of numbers to a Python module as a list or NumPy array. You can define the behavior of passing Array of Numbers to Python in any of the following ways:

You can store the return value of a function or a get attribute in an object reference as a PyObject. You can use the PyObject stored in the object reference as a parameter for a function or in a set attribute.
Note You should use a Python object created in a Python interpreter session only in that session.
You can pass TestStand objects or ActiveX objects that implement IDispatch from TestStand to Python. Store a reference to the object in an object reference variable, then pass the object reference variable to Python as a parameter. TestStand passes the parameter as a variable that is an instance of the CDispatch class as defined in the win32com.client.dynamic module.
Note You must install the pywin32 module from the Python repository in order to access the win32com.client.dynamic module.

When you set the parameter type to Dynamic, TestStand uses the type of the evaluated expression to determine how to pass the data to Python.

See Also

Python Enumeration Parameters