Python scope activity doesn't work , when code is running it doesn't allow to go inside the python scope and neither giving any error , how to solve this?

Python scope activity doesn’t work , when code is running it doesn’t allow to go inside the python scope and neither giving any error also it is running continuously , without giving any error and doesn’t going inside the python scope.

Did you check Python version is similar which you configure in scope

@Bh_P

Do you have multiple versions of python installed?

And did you configure the scope properly

Can you please validate

Cheers

Thx a lot , Yes , all are correct,(FYI- i have installed only one python version 3.6 (64 bit)),i also downgrade python version from python 3.11 to python 3.6 as i read somewhere that UiPath compatible with python 3.6 but yet it not works and even when it go inside the scope it shows the error as - "Run Python Script: One or more errors occurred. " and i also tried simple python code that doesn’t requires any dependencies to import in code like -’ print(‘Hello, world!’) ', so it runs without any error so i found that UiPath has not all python dependencies that python code requires to run so i am giving here all three required dependencies, that i used in python code that i want to run in UiPath i.e
(1) import PyPDF2 (2) import pandas as pd (3)import os , even i have also installed ‘windowsdesktop-runtime-5.0.17-win-x64’ and ‘windowsdesktop-runtime-5.0.17-win-x64’ also but still not getting solution . so plz help and also need to know all requirement that UiPath is only compatible with that , means python virsion 32bit/64bit/84bit ? etc. and also need to know that is python 3.11 (64 bit) works in UiPath or not , because in my case UiPath does not runs python version 3.11 (64 bit) and i need that version because it fulfills all requirement of my python code and i also ran python code in other environment successfully like ‘PyCharm Community Edition 2023.1.2’ and if i use other version like python 3.6 then python code is not running successfully because it needs dependencies that not available in that python version. Also plz help to give full successful process that can able to run python code in UiPath successfully . Thx a lot in advance.

@Bh_P

till version 3.10 it works…3.11 as of now I also faced issues…so I believe we have to wait

and for remaining issues when you see one or more errors…please open the locals panel and check the exception details it will show you the exact error

please use this and check the python path and use the same

import os
import sys
os.path.dirname(sys.executable)

and I hope pandas is installed

few resources here

cheers

Hi @Bh_P

Double-check the Python Scope configuration in UiPath. Make sure you have selected the correct Python environment in the PythonExecutable property and specified the path to the Python script in the Path property. Verify that the Python script exists at the specified location.

Thanks!!

hi @Anil_G

import os
import sys
os.path.dirname(sys.executable) - your given script ran successfully, but when i run my python script it is giving error and also already installed both pypdf2 & pandas in the system , might be issue is that UiPath cant take that from the system, here i giving detail error when i ran actual python script.

Error - RemoteException wrapping System.AggregateException: One or more errors occurred. —> RemoteException wrapping System.InvalidOperationException: Error running Python script —> RemoteException wrapping System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
ImportError : No module named PyPDF2

at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()
at UiPath.Python.Service.PythonProxy.Execute(String code)
at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass16_0.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Python.Activities.RunScript.d__8.MoveNext()
— End of inner exception stack trace —
at UiPath.Python.Activities.RunScript.d__8.MoveNext()
— End of inner exception stack trace —
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)

One more thing i added here for more clarification i.e when i ran python script during that ,in Locals , PythonEngineSessionProperty (type - object) shows - OutOfProcessEngine { Version=Python_36 } and in code (type - string) shows - null

hi @Nitya1
thx, all checked , all things are correct, also shows file name in Locals after running, here, putting screenshot also, hope that help to solve.
Capture21

The wait is over.

A new version of the Python package 1.7.1 was released which supports Python 3.11 (you can grab it from the official feed).

1 Like

run “pip install PyPDF2” in CMD