Python Installation And Executing Sample Python Script

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

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]

  1. Running Python script from Command line, the script 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
rtaImage.jpg

Running attached Python script from UiPath Studio

  1. Install the python activity package
  1. Add 'Python Scope' activity within the sequence.
  2. In 'Python Scope' properties - Provide the python installation path for the input parameter 'Path'.
  3. Add 'Load Python Script' activity with in 'Do' section of python scope.
  4. 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.
  5. Add 'Invoke Python Method' activity with in 'Do' section of python scope under 'Load Python Script' activity.
  6. 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.
  7. Add 'Get Python Object' activity with in 'Do' section of python scope under 'Invoke Python Method' activity.
  8. 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.
  9. Add 'Write Line' activity with in 'Do' section of python scope under 'Get Python Object' activity.
  10. 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.

rtaImage (2).jpg


Full Sequence screenshot:

rtaImage (3).jpg

3 Likes