Run Python Script- Python Automation

The Python automation package enables you to invoke and execute a python script wherever necessary, throughout the flow of the process. This is made possible by using the RunPythonScript component available in the SmartDesigner tool.

This activity helps you invoke a python script to carry out operations during execution.

Technical Reference:

 

 

 

 

INPUT

Executable path: Specify the path of the python app available in the system. The file should be a .exe file.

Parameters: Declare an argument type to give an input to the python file mentioned in the script path and also get an output of the updated script.

ScriptPath: Specify the location of the script that requires to be executed.

 

 

 

MISC

Display Name: Displays the name of the activity. You can also customize the activity name to help troubleshoot issues faster. This name will be used for logging purposes.

SkipOnError: It specifies whether to continue executing the workflow even if it throws an error. This supports only Boolean value “True or False”. By default, it is set to “False.”

True: Continues the workflow to the next step

False: Stops the workflow and throws an error.

Version: It specifies the version of the Python automation package in use

 

OUTPUT

Result: Declare a variable here to know the success state of the activity. This is not a mandatory field however declare a variable to get the result.

Text: Declare a variable here to store the output of the string that is executed.

* Mandatory fields to execute the workflow.

 The following activity illustrates on how we can use the run python script to get an output. Also, on how we can use this activity to give an input to the python script and get an output of the same.

Example:

1.      Drag and drop a run python script activity from the python automation package

2.      Click on the activity.

3.      In the executable path enter the complete path of the python.exe file

4.      In the parameters, if there is no input that we need to give to the python script, leave it to the default collections option.

5.      In the parameters if there is an input that needs to be given., we need to create an argument here which will be given as the input to the python script. Click on the three dots in the side to enter an argument.

 

6.      In the script path, enter the file path of the python script that has to be executed.

7.      In the text box of the output segment declare a variable, which will used to view the output of the executed python script.

8.      Drag and drop a write log activity below the run python script activity.

9.      Click on the activity and declare the variable given above and add .ToString to it, since the writelog accepts only string values. E.g., Test.ToString

10.   Execute the activity.

The bot executes the activity, runs the python script and gives the required output as mentioned in the python file. Here since it is given Print in the python script, the values are printed in the writelog.