Invoke Python Method: One or more errors occurred. 2023 10.8 Version of UiPath

This error message does not help me much.
I have UiPath Studio 2023.10.8
I’m using Python 3.12
Dependency using: UiPath.Python.Activities = 1.10.0

Workflow:
Python Scope
Inputs:
Library Path: “C:\Program Files\Python312\python312.dll”
Path: “C:\Program Files\Python312”
Target: x64
Version Python >=3.10

Load Python Script–works fine
File: “data-processing-branch\ExcessCalculation\data-processing.py”
Result: LoadedScript

Invoke Python Method–get the error.
Inputs:
Input Parameters:
{strExcessCalculationSSN,strExcessCalculationAmount,strExcessCalculationYear,strExcessCalculationSocialcodeBucket,strconfig,strPowerselect_username,strPowerselect_pwd_unmasked}
Instance: LoadedScript
Name: “excess_calculation_wrapper”
Output:
Result: MethodResult

I have my py that I could attach

Hi @tmartin

A small zip of a dummy Studio project that reproduces the issue would be appreciated.

This would help us debug the issue a bit quicker.

Also, just to confirm. Is this the case only for this script, or does it also occur with the simple hello world type of script?

i have not tried the simple hello word type of script.

I don’t know how to attach a zip file but this is what I have:


In the above I have given all the details of this image.

I have opened a ticket with the Support team to see if they can help me out.

Could you please share the support id for my reference? :slight_smile:

Here is the Case #: 02621361

Thank you.

I think to advise much further, we would need to know the full exception stack of this error.

Would you mind posting in here or in the support ticket the full error, as copied in Studio with the Copy to clipboard button?

that is the full error so that is why it is hard to figure out what the deal is.
Invoke Python Method: One or more errors occurred.

any suggestions on how to get more information?

Typically more should be available via the Details section.

There should be always a full exception stack attached to the error like so:

Let me run it and see. I’m just in debug so let me see what I can get. One moment

23.10.8+Branch.support-v23.10.Sha.818b15af14f0aa3b401053a36ba1f975c7e96560

Source: Invoke Python Method

Message: One or more errors occurred.

Exception Type: System.AggregateException

System.AggregateException: One or more errors occurred. —> System.InvalidOperationException: Error invoking Python method —> System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
module ‘1d84e8c0-65ea-440c-8a2e-c42dfececca5’ has no attribute ‘excess_calculation_wrapper’
at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()
at UiPath.Python.Service.PythonProxy.InvokeMethod(Guid instance, String method, IEnumerable1 args) at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass15_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()
— End of inner exception stack trace —
at UiPath.Python.Activities.InvokeMethod.d__16.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)

This seems to be the important part:

Could you double check the naming in your script, especially around this phrase:

excess_calculation_wrapper

(which apparently cannot be located)

yeah i just did.
“def excess_calculation_wrapper(ssn,amount,year,socialcode,config_content, username, password, close_date_date =str(datetime.datetime.today().date()) , close_date_format =‘YYYY-MM-DD’):\n”,
“\n”,

In this case, the best course of action is to simplify the script file to a minimum (a dummy hello-world type of script), with the same name.

Quick question - why do you have line breaks at the end of the script definition in the sample above? For reference, a complete working dummy script that should work for sure is just this:

def dummy_func():
    return "hello"

i did not write this code another coworker did and they are no longer with the company. so i’m just trying to get it to work with Python 3.12 since we are on 3.6 now.

I did just see that I have Python 3.13 and 3.12 on this VM. I have asked for them to remove it and will test again.

I’m going to go to my other VM that I think only has 3.12 and will test my theory out. then i will do the simple code.

get same error on the other VM that I have just Python 3.12. I will try the simple script and see if it works

With the simple code I get this:

23.10.8+Branch.support-v23.10.Sha.818b15af14f0aa3b401053a36ba1f975c7e96560

Source: Invoke Python Method

Message: One or more errors occurred.

Exception Type: System.AggregateException

System.AggregateException: One or more errors occurred. —> System.InvalidOperationException: Error invoking Python method —> System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
dummy_func() takes 0 positional arguments but 7 were given
at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()
at UiPath.Python.Service.PythonProxy.InvokeMethod(Guid instance, String method, IEnumerable1 args) at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass15_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()
— End of inner exception stack trace —
at UiPath.Python.Activities.InvokeMethod.d__16.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)

1 Like

This one should be rather easy to fix:

The Invoke Python activity lets you set some Input Parameters, and you are setting 7 instead of none (because none are required).

To run this script, you simply have to remove the input parameters from that activity and retry.

After that, I suppose it is about filling this sample script with more lines of the original one, if not line by line, then part by part.

For example, you could add the argument names again on just the dummy function, without yet using them. And if that works, add some more things.

If you are able to share the project via the support ticket, or at least the script file, I might be able to have a look and help you out.

i did get it to work. but still can’t get the real one to work.
and the script has excess_calculation_wrapper why is it saying no.

i don’t know how to slim this down to do small python to see where the issue is

i have updated the Case in Customer Portal if you want to take a look at it

I’ll be able to have a closer look at it tomorrow, but from a quick look, it seems like your functions are actually contained in a JSON formatted structure.

This is not how the activity ingests them, and this is mostly where the issue is.

You will have to deserialize the JSON and then provide the deserialized string of your function to the Load Python Script activity. I will suggest some more concrete approaches for that tomorrow.