Execute Python Script
Description
Execute Python Script is a step in the Scripting Plugin for Process Studio Workflows. This step is used to execute Python Script.
Recommendation: For more accurate execution results, we recommend using Python version 3.10.0 and above.
Prerequisites
Three ways to install Python:
-
Install using python.exe:
- Download python.exe from https://www.python.org/downloads and install it.
- Install required python 3rd party libraries using pip, according to your requirements.
- Add/Append the following file paths to the PATH Environment Variable as follow:
<path_till_python_directory>\Python310;<path_till_python_directory>\Python310\Scripts;
-
Install using Anaconda software:
- Download Anaconda from https://www.anaconda.com/download and install it.
- Manually set Anaconda in the PATH environment variable by adding the following to the path:
<ANACONDA_BASE>; <ANACONDA_BASE>\Library\mingw-w64\bin; <ANACONDA_BASE>\Library\user\bin;<ANACONDA_BASE>\Library\bin;<ANACONDA_BASE>\Scripts; - Install required python 3rd party libraries using conda or pip or Anaconda GUI, according to your requirements.
Note: Please note that for above two types of installation, it is user's responsibility to install python and its dependencies and troubleshoot the problems if any related to python setup.
- Install using AE_Python:
- Get python setup zip(Python36.zip or Python38.zip or Python310.zip) file from AutomationEdge.
- Extract the python setup zip.
Note: AE_Python.zip is available only for Windows OS. For other OS users, please reach out to your System Administrator for help with Python installation.
Advantages of using AE_Python zip:
- The extracted python file from zip takes considerably less hard disk size as compared to python using Anaconda setup.
- If system is using let's say Python 3.x and if user wants to use Python 3.10.0 for AE purpose, then user can do so easily by keeping AE_Python inside specific location.
Users original Python 3.x and path in environment variables will not be touched.
For Default Installation:
- Get Python Setup zip(For example, Python310.zip) file from AutomationEdge.
- Extract Python310.
- Add the following filepaths to the PATH Environment Variable as below:
<path_till_python_directory>\Python310;<path_till_python_directory>\Python310\Scripts;
For AE Specific Installation:
- Get Python Setup zip(For example, Python310.zip) file from AutomationEdge.
- Close Process Studio instances and/or Agents where Machine Learning plugin is to be used.
- Create a folder called as ‘python’ – case sensitive i.e., all letters in small case – in
your
<Process Studio root>and/or<Agent root>folders*. - Unzip the downloaded zip file in following location:
<Process Studio root>/python/and / or<Agent root>/python/ - Post completion of above step, your folder structure should now look like
<Process Studio root>/python/AE_Python<Version>E.g.,D:/process-studio/python/AE_Python310<Agent root>/python/AE_Python<Version>E.g.,D:/ae-agent/python/AE_Python310 - Start Process Studio instances and/or Agents wherever this change has been made. In case if we have not already closed either the Process Studio instance or AE-Agent instance, simply restart these instances to achieve the same impact.
Note: <Process Studio Root> is the main Process Studio folder once you have unzipped the Process Studio zip file downloaded from AEUI (by default, the folder name is process-studio) and similarly <Agent home> is main agent folder after unzipping <named ae-agent>.
Configurations
| No. | Field Name | Description |
|---|---|---|
| 1 | Step name | Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow. |
| Row Handling: | ||
| 2 | No. of rows to process | Select No. of rows to process for row handling from input steps data frames from the following, - All - Row by Row or - Batch: If batch is selected a value needs to be provided in the size field. |
| 3 | Reservoir Sampling | Enable checkbox to randomly sample rows from an incoming data stream. If checkbox is enabled a value needs to be provided in the size field. Random seed field is also enabled and user can provide a value. |
| 4 | Random seed | Random seed is enabled only if Reservoir checkbox is enabled. Provide a value to use for seeding the random number generator. Repeating a workflow with a different value for the seed will result in a different random sample being chosen. |
| Options: | ||
| 5 | Include Input Fields as Output Fields checkbox | Enable this checkbox to include incoming fields as output fields. |
| Input Frames: | ||
| 6 | Step name | Input step name are visible here in a dropdown list. Data from input steps is available as a Data frame. |
| 7 | Pandas frame name | Provide Pandas frame name for step name above. Or else use system generated name (for e.g. ps_data0) |
| Field Name | Description |
|---|---|
| Python Script | |
| Load Script from file at Runtime | Enable checkbox to load python script dynamically from a file at runtime. |
| Script file Location and Browse button | Browse for the python script file. |
| Manual Python Script | It is a free textbox where user can write Python Script. |
| Python Variables to get | Provide output variable name or frame name from the python script. |
| Continue on unset variables | Enable checkbox to specify: Don’t raise an error if specified variables are not set in python after script has executed. |
| No. | Field Name | Description |
|---|---|---|
| Output Fields: | ||
| 1 | Output Fields: | |
| 1 | Name | Get the name of python output fields. |
| 2 | Type | Provide the data type of the field above. |
| Buttons: | ||
| 1 | Vars to Fields | Click button to get Python frame. |
| 2 | Get Frame Fields | Click button to the Frame fields. |
| 3 | Include frame row index as an output field checkbox | Enable checkbox to Include frame row index as an output field. |