Problem: PyObject_CallObject always returns null
MyFuc mypModule=PyImport_ImportModule (" ");//here to call python file name
If (NULL==mypModule)
{
STD: : cout & lt; <"Test import model failed!"
return;
}
PDict=PyModule_GetDict (mypModule);
STD: : string sFuncName="Lesion_detection";
The PyObject * pFuncTwo=PyDict_GetItemString (pDict, "Lesion_detection");//call the function name
If (NULL==pFuncTwo)
{
STD: : cout & lt; <"PFuncTwo is null" & lt;
return;
}
The PyObject * FuncTwoBack=PyObject_CallObject (pFuncTwo nullptr);//returns the List
If (NULL==FuncTwoBack)
{
STD: : cout & lt; <"FuncTwoBack is null" & lt;
return;
}
Python code:
The from test_pred_3d import do_testing
The import pandas as pd
The import numpy as np
The import OS
Def Lesion_detection () :
Pred_bboxes=pd. Read_csv (OS) path) join (' temp ', 'pred_bboxes. CSV))
# print (pred_bboxes. Values)
IntegerList=pred_bboxes. Values. Tolist ()
Return IntegerList
Python code to run is no problem, if you write a pandas reads the data structure is also no problem, a read CSV file PyObject_CallObject always returns null