Jesmine
(Jesmine Trejo)
April 22, 2022, 11:34am
1
Hi Team, @Adit2917 , @supermanPunch
Hope you guys are doing great!
My problem: I am passing file path inside python script. After that it will return data frame. like
output = tables.export(FilePath +“.csv”)
return= output
Uipath throwing error: “Get Python Object: Error converting Python object”
My flow:
Can you share any dummy workflow?
Thanks
jeevith
(Jeevith Hegde, Ph.D.)
April 22, 2022, 11:53am
2
Hi @Jesmine ,
I think it is the python script which is the cause here.
As I said in the above post and links in them, it is important that you refer to a function in your Python script. I am assuming that your method is called “read_pdf” from the screenshot.
Can you also share a pseudo code of your python script?
@Jesmine , As the Error States, it is due to the Wrong Type being Selected as TypeArgument in Get Python Object Activity.
Could you show us or let us know what was the Type used ?
@Jesmine ,
The Conversion from Python DataFrame to c# Datatable most probably cannot be a direct conversion.
We would require to convert the dataframe in Python to a Json String and return the string, then Deserialize the String to Datatable in the workflow.
Below post Explains the Conversion :
I was also having issues with this earlier, but found out this solution somewhere on stack overflow which worked for me.
You can convert the python dataframe to datatable format using the following three steps.
Python Script:
Return python data frame as JSON string i.e. return df.to_json(orient='records')
Get Python Object:
Save the JSON string in a variable of type string
Deserialize JSON:
Choose ‘System.Data.DataTable’ as TypeArgument and store the result in a variable of type dataTa…
system
(system)
Closed
April 25, 2022, 12:56pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.