diff --git a/Source/src/python/PythonModule.cpp b/Source/src/python/PythonModule.cpp index c976fb5e..ae811e99 100644 --- a/Source/src/python/PythonModule.cpp +++ b/Source/src/python/PythonModule.cpp @@ -17,7 +17,7 @@ PythonModule::PythonModule(QObject* parent) assert(init_); QString appDir = QString("%1/test.py").arg(Application::applicationDirPath()); - CallFunction(appDir, "test"); + CallFunction("myPyTest", "myFunc"); } PythonModule::~PythonModule() { @@ -47,10 +47,19 @@ bool PythonModule::CallFunction(const QString& py, const QString& name) { } PyObject* func = PyObject_GetAttrString(module, name.toStdString().c_str()); if (nullptr == func) { + PyErr_Print(); LOG_WARN("PyObject_GetAttrString faile: {}", name.toStdString()); return false; } - PyObject_CallFunction(func, NULL); + + //PyObject* arg = Py_BuildValue("i", 32); + PyObject* ret = PyObject_CallFunction(func, "i", 32); + if (nullptr != ret) { + int value = 0; + int r = PyArg_Parse(ret, "i", &value); + LOG_INFO("PyArg_Parse : r:{}, value:{}", r, value); + } + return true; }