The Python task allows for the running of Python scripts using an environment available on a host that has the Loome Integrate Agent installed. The Python script can be entered in the Loome Integrate application, with the execution handled by the native python installation on the host PC.
If you do not have a Python environment, you can download Python using the following guide.
Follow the next section if you already have a Python environment to learn how it can be used in Loome Integrate.
Go to https://www.python.org/downloads/windows/ and find the installer for the version you want to download.
For this example, we are using Python 3.7 shown in the following image.
Run the installer and make sure that ‘Add Python 3.7 to PATH’ is unchecked (as the image below).
Then select Customize Installation.
Select all optional features.
On the next page, take note of the Customize Install Location value. You can change this location but make sure to remember and note where you install it, as it will be needed for your environment later.
Once the installer has run successfully, you will be able to create an environment at the install location selected in the above step.
Python tasks require at least one Python Environment to be configured for the agent you want to run the Python script on.
Python Environments point to the location on the agent’s host where the Python installation you wish to use is located, in most cases this is the default installation of Python depending on your operating system.
To add a Python environment, on the Agent page, select the settings button for the agent that has the Python installation located on its host.
On the left you will see a Python Environments tab, in this tab you can easily add and remove Python Environments for that agent.
Add a name for your environment, and provide the file path for its location. The path is where the Python setup was installed.
Click on Add Environment and you can now use your Python environment in Loome Integrate.
The executable for the Python environment must be named
python3 to be compatible with Loome Integrate Online.
If using an Agent Docker image, Python 3 is installed in
The location of a Python environment is the path to the folder that contains the
python executable. This can be usually found with Powershell using
[System.IO.Path]::GetDirectoryName((Get-Command python).Source) and with bash using
To learn how to use a File Connection as your Script Source to execute a script from a file in your Git Repository, please read more here.
Create a new task in your chosen job.
Provide a name for this task.
Choose the agent that has the Python environment (See how to add a Python environment to an agent in the section above).
Select Python as your task type.
You can enable a setting for this task to run scripts in parallel. This will allow the Loome Integrate agent to execute multiple scripts in parallel, rather than in sequence. Learn more here.
On the next page, you can then add your script for Python or select a file from a Git Repository.
Choose whether you would like to use a script or Git Repository under Script Source.
If you have chosen to use a script, provide your script to the Python Script section.
Select your Python Environment from the dropdown.
(Optional) You can also choose to add parameters.
All script parameters will be added as a session variable, and these can be used by referencing the parameter name.
Submit this task and you can now run your Python script.