Unable to run python script through Studio

Hi all,

I’m unable to run my python script from Studio. I’ve tried everything for the past 2 weeks digging through these forums and tried every solution I found. Not a single one worked for me.

I have a sample project that I’m just trying to get to work. My sample python file just has a main function which returns a string “Hello World”. I want my project to be able to display that with a message box activity (testing purposes) because my project doesn’t get past “Error initializing python engine” part.

The error I keep receiving is:

Source: Python Scope

Message: Error initializing Python engine

Exception Type: System.InvalidOperationException

RemoteException wrapping System.InvalidOperationException: Error initializing Python engine —> RemoteException wrapping System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
Exception has been thrown by the target of an invocation.


** at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()**
** at UiPath.Python.Service.PythonProxy.Initialize(String path, String libraryPath, Version version, String workingFolder)**
** at UiPath.Python.Impl.OutOfProcessEngine.Initialize(String workingFolder, CancellationToken ct, Double timeout)**
** at UiPath.Python.Activities.PythonScope.d__41.MoveNext()**
** — End of inner exception stack trace —**
** at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context, Object value)**
** at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)**
** at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)**
** at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)**

This is what my code looks like

I put the correct path for Python and to the **dll file. Python version on my system is Python311.

I’m not sure what else is causing this? Any help is appreciated.

Thanks in advance

Hi @rkche

To quickly check you can try running using start process as well. Pass the python.exe path and the argument as your .py file .

Also generally we see this when there are multiple instances of python that are available and the classpath in the environment variables is not updated

Cheers

Hi @rkche

Welcome to UiPath community

Check out the Tutorials

Regards
Gokul

hello, i have a problem when i want run my python script in uipath
RemoteException wrapping System.IO.IOException: Le canal est endommagé.
à System.IO.Pipes.PipeStream.CheckWriteOperations()
à System.IO.Pipes.PipeStream.Flush()
à System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
à System.IO.StreamWriter.Dispose(Boolean disposing)
à System.IO.TextWriter.Dispose()
à UiPath.Python.Service.PythonProxy.RequestAsync(PythonRequest request, CancellationToken ct)
à UiPath.Python.Service.PythonProxy.Shutdown()
à UiPath.Python.Impl.OutOfProcessEngine.Release()
à UiPath.Python.Activities.PythonScope.Cleanup()
à UiPath.Python.Activities.PythonScope.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
à System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
à System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

the version uiapath python activitie is 1.6 strict
python scope use auto selection for the python version and the target is 64 bits

this errors code :
RemoteException wrapping System.IO.IOException: Le canal est endommagé.
à System.IO.Pipes.PipeStream.CheckWriteOperations()
à System.IO.Pipes.PipeStream.Flush()
à System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
à System.IO.StreamWriter.Dispose(Boolean disposing)
à System.IO.TextWriter.Dispose()
à UiPath.Python.Service.PythonProxy.RequestAsync(PythonRequest request, CancellationToken ct)
à UiPath.Python.Service.PythonProxy.Shutdown()
à UiPath.Python.Impl.OutOfProcessEngine.Release()
à UiPath.Python.Activities.PythonScope.Cleanup()
à UiPath.Python.Activities.PythonScope.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
à System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
à System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)