Python Scope

I got this error → Python Scope: Error initializing Python engine

Hi @Sukanya_Dutta

Have a look on the Tutorial

Regards
Gokul

Hello @Sukanya_Dutta , Check your python version and the UiPath pyton activiy was in updated

Python version is 3.6

@Sukanya_Dutta , Did you add your python path in System Environment variables?
image
image

Yes I have added

@Sukanya_Dutta , Also check the Python activity version in uipath
image

@Sukanya_Dutta , I’m not sure about this, just upgrade your Python verson and install properly with pip installer and try again in uipath
I’m using Python 3.8.10 , not facing any issues
Download link: https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe
Pip Installer steps: pybase64 · PyPI
Kindly try this, it may work for you.

@Sukanya_Dutta also check the Properties and data you have entered are cross check.

  • Check the path of python
  • select the Target
  • Check the correct version
  • check the Working Folder (Script Folder)
    image

Try to install python from here Python Release Python 3.10.1 | Python.org and then restart the machine.

Based on https://docs.uipath.com/activities/docs/release-notes-python-activities , in v1.6.0 we fixed an issue where UiPath.Python.Activities v1.4.1 would not support Python v3.10.1.

Let us know if this helped.

1 Like

The python scope must be defined as it cannot be accessed from anywhere in the program. The particular coding region where variables are visible is known as scope. Variables are not visible to the entire code. Their visibility can be restricted. Scope verifies which variable can be Seen. The scope defines the set of rules which tell us how and where a variable can be searched. The variable is searched either to retrieve a value or for assigning value. The namespace is the unique identification of the variable or the method. Namespace tells the python interpreter about the name of the object and the location from where it is trying to access it.
The Variables which are defined in the function are a local scope of the variable. These variables are defined in the function body. Let’s understand this concept with the help of an example.
we have taken one variable num. Num = 0 is defined outside the function, so it is not a local variable. As per our definition, the variables which are declared inside the function body is a local variable. Here num=1 is a local variable that is declared and printed inside the function demo. If we run this code, the output is given below.

num=0
def demo():
#print(num)
num=1
print(“The Number is:”,num)
demo()