Python Module
  • 24 May 2021
  • 1 Minute to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Python Module

  • Dark
    Light

Article summary

Overview

The Python Module allows a user to execute Python scripts.

Prerequisites:
The following is required before using the Python Module:
  • Python needs to be downloaded and installed.
  • Python Module needs to be properly installed and set up.

    For more information on how to install Modules in Decisions, see: Installing Modules.


To use the Python Module, Python will be needed. To download Python, go to https://www.python.org/downloads/windows/.

The following code example is the Python script used in this example. It will take in two input values.

import sys
def main():
    print("Welcome", sys.argv[0])
    if len(sys.argv) == 3:
        print(" ", sys.argv[1], " ", sys.argv[2])
if __name__ == "__main__":
    main()

Example

  1. Install the Python Module by navigating to System > Administration > Features, find Python within the Available Features column. Select INSTALL.2019-06-07_115946.png
  2. Select the System folder, in the action menu select Restart Instance.

    2019-06-12_115927.png

  3. Navigate to the System > Settings Folder, select the Python Module Settings. Copy and paste the path in the Edit Python module settings dialog. The path will typically be something similar to the following: C:\Users\....\AppData\Local\Programs\Python\Python38\python.exe.2019-06-07_120134.png
  4. Navigate to System > Integrations > Python Script Projects > Add Script Project.2019-06-07_120541.png
  5. In the Add Script Project dialog, type any name for the project, select SAVE.
    2019-06-07_120932.png
  6. Select the added script project and select ADD SCRIPT.2019-06-07_121148.png
  7. Enter a name for the script and select Default in the Read Python Path From drop-down list.
  8. Upload a valid python script and under Inputs enter names for inputs values. Then, select OK.
  9. Within the Flow Designer, expand the Integration > Python category in the Steps panel. 2019-06-12_150949.png
  10. With the step selected, change the input value mappings to Constant and enter "Hello" for string1 and "World" for string2. Then, connect the Error path and Success path to the End step.
  11. Click Save to save changes to the Flow.

Debug

  1. On the top action bar, click Debug. Then, click FULL.
  2. After the Debugger runs, click the Python step. Select Execution 1 and select View Input/Output Data.

Was this article helpful?