1 #include <lib/python/python.h>
4 extern "C" void init_enigma();
18 int ePython::execute(const std::string &pythonfile, const std::string &funcname)
20 PyObject *pName, *pModule, *pDict, *pFunc, *pArgs, *pValue;
22 pName = PyString_FromString(pythonfile.c_str());
24 pModule = PyImport_Import(pName);
29 pDict = PyModule_GetDict(pModule);
31 pFunc = PyDict_GetItemString(pDict, funcname.c_str());
33 if (pFunc && PyCallable_Check(pFunc))
35 pArgs = PyTuple_New(0);
36 // implement arguments..
37 pValue = PyObject_CallObject(pFunc, pArgs);
41 printf("Result of call: %ld\n", PyInt_AsLong(pValue));