I was trying to return an array of data from python function to Javascript. I am using eel python module. The python function returns a string with ease, but when I tried to return an array object, it returns nothing to javascript.
Here is the python function:
@eel.expose
def get_list_data(column_name):
tree = ET.parse('resources.xml')
root = tree.getroot()
column_list_data = []
for child in root.findall('column'):
if child.get('name') == column_name:
for grandchild in child:
column_list_data.append(grandchild.text)
return(column_list_data)
And here is the javascript function.
function getListData(){
let retData = eel.get_list_data("Response")();
console.log(retData);
}
getListData();
Here is the console log shows.
Promise
__proto__: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: Array(0)