UNABLE TO INVOKE PYTHON SCRIPT THAY HAS API REQUEST FUNCTION

HELLO, I am trying to invoke python method that the method is to talk to the website api. I tried to work them on ide and it works. However, it does not work in uipath when invoking them, first I met

  1. No module named cryptography

detail:
RemoteException wrapping System.AggregateException: One or more errors occurred. —> RemoteException wrapping System.InvalidOperationException: Error invoking Python method —> RemoteException wrapping System.InvalidOperationException: Python instantiation exceptionPython Invoker program exception:ImportError : !!!No module named cryptography!!!

at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded() at UiPath.Python.Service.PythonProxy.InvokeMethod(Guid instance, String method, IEnumerable1 args) at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass14_0.<InvokeMethod>b__0() at System.Threading.Tasks.Task1.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.InvokeMethod.d__16.MoveNext()

https://stackoverflow.com/questions/39180609/importerror-no-module-named-cryptography

according to the content on stackoverflow i install cryptography and paramiko to solve this issue

But then I met

  1. System.IO.IOException: Pipe is broken.

RemoteException wrapping System.AggregateException: One or more errors occurred. —> RemoteException wrapping System.InvalidOperationException: Error invoking Python method —> RemoteException wrapping System.IO.IOException: Pipe is broken.

at System.IO.Pipes.PipeStream.CheckWriteOperations() at System.IO.Pipes.PipeStream.Flush() at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at UiPath.Python.Service.PythonProxy.RequestAsync(PythonRequest request, CancellationToken ct) at UiPath.Python.Service.PythonProxy.InvokeMethod(Guid instance, String method, IEnumerable1 args) at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass14_0.<InvokeMethod>b__0() at System.Threading.Tasks.Task1.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.InvokeMethod.d__16.MoveNext()

I am not able to fix the problem from uipath side, could any expert help with this issue?

Hi @Yu_Ming_Chang,

Welcome to the community.

  1. The python installation you are using does not have the cryptography library installed
    UiPath does not care if python is installed in your computer or is running from a pendrive. All it cares is that it has access to python.exe executable. Refer this thread: How to run python script in UiPath without installing python? - #4 by jeevith

    Now you have to first find out if that particular python path has the required libraries installed. In your case the cryptography package. You can do this by using the pip freeze in PowerShell.
    Example:
    image

  2. Pipe is broken
    This occurs in UiPath when the workflow forwards or receives large amount of data. Not just a problem in Python Scope. This can also happen in other scenarios, such as when you are pooling a large datatable and trying to send this to another UiPath workflow.
    Refer this thread: Invoke Python Method: Pipe is broken - #3 by jeevith