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.
When creating a task, select Python, and the agent that has the Python environment we added above.
On the next page, you can then add your script for Python or select a file from a Git Repository.
All script parameters will be added as a session variable, and these can be used by referencing the parameter name.
Select your Python environment from the dropdown.
Submit this task and you can now run your Python script.