Python object conversion error

Hi Experts,


In my one use case, I am using this python code
"import tabula
from tabula import read_pdf
import pandas as pd

def read_pdf_and_sum(file_path, encoding=“utf-8”):
# Specify the path to the PDF file
pdf_file_path = “Test.PDF”

    # Read the PDF file
    data = read_pdf(pdf_file_path, pages="all", encoding=encoding)
    print("Data after reading PDF:", data)

    # Combine the tables into a single DataFrame
    merged_df = pd.concat(data, ignore_index=True)
    print("Merged DataFrame:", merged_df)

    # Identify columns with monetary values
    monetary_columns = merged_df.columns[merged_df.apply(lambda col: col.str.contains('SAR')).any()]

    # Convert identified columns to numeric
    merged_df[monetary_columns] = merged_df[monetary_columns].replace({'[,SAR]': ''}, regex=True).apply(pd.to_numeric)

    # Sum the identified columns and append the total values as the last row
    total_values = merged_df[monetary_columns].sum().tolist()  # Convert to list
    merged_df = merged_df.append(dict(zip(monetary_columns, total_values)), ignore_index=True)

    # Print all values in the total_values list
    print("Total Values:")
    for value in total_values:

    # Print total_values in a specific format
    print(','.join(map(str, total_values)))

    return total_values
except Exception as e:
    print(f"An error occurred: {e}")
    return None

Call the function

total_values = read_pdf_and_sum(“Test.PDF”)

and it returns a list of integers, but when on my UiPath code I am using the “Get Python Object” activity, and it throws an error as “Get Python Object: Error converting Python object”. The output I am using is a list of integers.

Your help would be much appreciated.


Hi @learning_sourav

Which is the Python version ?

The Python activity pack is compatible with Python versions 3.11 and lower.

  • For Windows - Legacy projects, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11.
  • For Windows projects, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11.

Python version is 3.6 and trying with Windows-Legacy.


  1. Try with integer array instead of list
  2. Alternately …generally this object conversion does not fail if you use a string…so join the list and convert to a string and then split in UiPath to get the list back. Whatever you are using in print can be used in return and then split in UiPath


Hi @learning_sourav,

You should set the type argument to Array of type Int32 and use a variable for the same type.

Let’s say your python code returns a list like this,

In UiPath use are executing the script in the following way,

Then the output of the log message would be like this,