Step To Invoke Python Code In Uipath

Step 1 : Install the 3.6.0 or 3.6.0 Below version of python
(Python Release Python 3.6.0 | Python.org)

Step 2 : Move to Uipath Studio,install the (Uipath.Python.Activities) Packages

Step 3 : Use Python Scope Activity
In Python Scope Properties
Path:python installation path
Ex(C:\Users.…\AppData\Local\Programs\Python\Python36)
Target & Version:Based on your System Configuration

Step 4 : In Python Scope Activity,Drag and Drop the Load Script Activity
Load Script Properties
Code:Enter your cose directly (or)
File:Select the python script file(your code)

Step 5 : Drag the Drop the invoke python Method Activity
invoke python Method Properties
Input Parameter :Pass the value to python code. Ex : {β€œ1”}
Instance :Load script activity Result
Name :Enter the python code definition Name.

Step 6 : Drag and Drop the Get Python Object
Get Python Object Properties
Python Object :Enter invoke python Method Result
Result :Results from the python code.

Refer the link for Pip install Configuration (how to install pip: Installing pip on Windows - DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»)

4 Likes

Hello there,
I want to invoke a Python Script in UiPath and have followed all the steps done in a tutorial I found. However, though the Python Scope does not throw an error, no activity within is executed (not even the first message box). What is the problem? Since I am a new user here are the property values from the Python Scope activity:
Path: β€œC:\Users*MYNAME*\AppData\Local\Programs\Python\Python310”
Target: β€œx64”
Python = β€œ>=3.10”

I get compilation error if i enter the code directly

  • Give python version as β€œauto”
  • install windowsdesktop-runtime-5.0.17-win-x64.exe in your pc
  • add python path into your environment variable