Python installation and executing sample python script

How to install and execute Python script using the command prompt UiPath activities ?

Python activity version - 1.1.6863.33404


Installation of Python

  1. Open the following URL - https://www.python.org/downloads/release/python-360/
  2. Download – WindowsX86 or x64 executable installer ( The version mentioned above supports both 32 and 64-bit Python )
  3. Click install and follow the steps [Python will be installed in the local app data]

Running Python script from Command line

The script attached prints or returns "Hello World !!!" string.

Open command prompt 

  1. Type 'Python' followed by script file name along with the full path to be executed as shown in below snippet

Running attached Python script from UiPath Studio

  1. Install the python activity package

2. Add 'Python Scope' activity within the sequence.
3. In 'Python Scope' properties - Provide the python installation path for the input parameter 'Path'.
4. Add 'Load Python Script' activity with in 'Do' section of python scope.
5. In 'Load Python Script' properties - Provide the full path to the script to be executed and create a variable to store output of the 'Load Python Script' activity.
6. Add 'Invoke Python Method' activity with in 'Do' section of python scope under 'Load Python Script' activity.
7. In 'Invoke Python Method' properties - Provide the 'Instance' which should be the output of 'Load Python Script' activity. Provide name of the function in 'Name' property.  Create a variable to store output of the 'Invoke Python Method' activity.
8. Add 'Get Python Object' activity with in 'Do' section of python scope under 'Invoke Python Method' activity.
9. In 'Get Python Object' properties - Provide the 'Python Object' which should be the output of 'Invoke Python Method' activity. Create a variable to store output of the 'Get Python Object' activity.
10. Add 'Write Line' activity with in 'Do' section of python scope under 'Get Python Object' activity.
11. In 'Write Line' properties - Provide the 'Text' which should be the output of 'Get Python Object' activity and convert it to string using ToString method.


Full Sequence screenshot: