Error converting Python object

Hi,

I am trying to invoke Python code from UiPath.

I use Invoke Python Method, it is successful all the times. But when I use Get Python Object to retrieve the .net datatype, System.InvalidOperationException occurs.

I can succesfully get String, Double values. But the Get Python object fails when I try to return Tuple(Double) or List(Double) from Python. I use Tuple(Double) and List(Double) in the TypeArgument option in the Get Python Object.

Kindly let me know how to retrieve Tuple and List from Python to UiPath.

Cheers! :slight_smile:

1 Like

@Udhay You should try converting the python object to type Array, of which elements are of type Object. Then you can further process/cast the items downstream, as necessary.

Best,
Hari

1 Like

Hello,

What I did was, I converted python output in a string format.

return str(output)

It worked for me. :slight_smile:

Hope this helps!

1 Like

if I want to return a list in python, but it not works well in Uipath
so I did this:

I add s = "-".join(list1) to return a string actually in python code,
and in Uipath I use for each, the in ares I input result.split("-"c) to print the list item I want.

hope this hepls