#include #include #include #include int main() { CPyInstance hInstance; CPyObject pName = PyUnicode_FromString("pyemb"); //CPyObject pName = PyUnicode_FromString("resnet_predict"); //passing name of file CPyObject pModule = PyImport_Import(pName); //importing the file if (pModule) { std::cout << "Module load successful" << std::endl; CPyObject pFunc1 = PyObject_GetAttrString(pModule, "test"); //passing name of function to be called if (pFunc1 && PyCallable_Check(pFunc1)) // checking if not null and callable { PyObject_CallObject(pFunc1, NULL); //call function, return value is stored in pValue //printf_s("C: getInteger() = %ld\n", PyLong_AsLong(pValue)); } else { printf("ERROR: function test didn't run as intended\n"); } /* CPyObject pFunc = PyObject_GetAttrString(pModule, "getInteger"); //passing name of function to be called if (pFunc && PyCallable_Check(pFunc)) // checking if not null and callable { CPyObject pValue = PyObject_CallObject(pFunc, NULL); //call function, return value is stored in pValue printf_s("C: getInteger() = %ld\n", PyLong_AsLong(pValue)); } else { printf("ERROR: function getInteger()\n"); } */ } else { printf_s("ERROR: Module not imported\n"); } return 0; } /* Exception ignored in: Traceback (most recent call last): File "C:\Anaconda3\envs\Deep_Learning\lib\threading.py", line 1289, in _shutdown assert tlock.locked() SystemError: returned a result with an error set */