Pyimagej not converting strings

Hello,

so I am trying to run a macro + plugins from Python using PyimageJ, but at some point the latter is not converting properly the Java string into a Python string.

The following Python code

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import easygui
import imagej

ij = imagej.init("/home/my_user/Programs/Fiji.app", headless=False)

macro = """
run("Clear Results");
print("\\Clear")

#@output Object filepath_image

setBatchMode(true);

filepath_image = File.openDialog("Select an Image File");
file_split = split(filepath_image, ".");

filepath_ROIs = File.openDialog("Choose a Metamorph .rgn File");

"""
result = ij.py.run_macro(macro)
path = result.getOutput("filepath_image")

print(path)
type(path)

gives me the following output:

my_file_name
<java class 'java.lang.String'>

but when I try to convert this string into a Python string it gets converted into a “xarray.core.dataarray.DataArray”, instead of a Python string.

Any idea of what can be the problem?

PS: I am fairly new to Java, so any help will be very much appreciated. Thank you!