Python
(Available from version 7.2 onwards)
Prerequisites
-
Python must be installed on the machine running the automation solution.
-
Ifimport statements are used in the Python code, IronPython must also be installed. Download and install the latest version of IronPython from the official IronPython website.
-
The Python code must be correctly indented.
Functions
Executes a block of Python code written in a text file.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
Complex Type |
Contains all parameters required by the function. |
Returns
Returns the value of the Output Variable specified within the Python Parameters for Code type, as text.
Example
This workflow populates the required fields of varPyCode, an instance of the Python Parameters for Code type, and then parses varPyCode to the function.
The content of the file greaterThan.py is shown below. The script is allocated two integers x and y, and binds the largest value to z.
When the workflow is executed, the value of textVar is set to 5, as expected.
Executes a Python method, belonging to a Python class, written in a text file.
Parameter |
Input Type |
Description |
---|---|---|
Complex Type |
Contains all parameters required by the function. |
Returns
Returns the value of the method, as text, if applicable.
Example
This workflow populates the required fields of varPyCodeMethod, an instance of the Python Parameters for Method type, and then parses varPyCodeMethod to the function.
The content of the file tools.py is shown below. Two integers x and y are parsed to the greaterThan method, which returns the higher value.
When the workflow is executed, the value of txtResult is set to 5, as expected.