I am trying to call Sympy's lambdify from C++ code using Python/C API. The code is pasted below.
const char * file = "sympy";
const char * function = "lambdify";
Py_Initialize();
PyObject* pModuleString = PyString_FromString(file);
PyObject* pModule = PyImport_Import(pModuleString);
PyObject* pFunction = PyObject_GetAttrString(pModule, function);
PyObject* pargs = PyTuple_Pack(2,PyString_FromString("x,y"), PyString_FromString("x+y"));
PyObject* presult = PyObject_CallObject(pFunction, pargs);
Py_DECREF(pModule);
Py_DECREF(pModuleString);
Py_DECREF(pFunction);
Py_DECREF(pargs);
Py_Finalize();
The line PyObject* presult= blah shows the following error
Exception AttributeError: "'NoneType' object has no attribute 'f_locals'" in <module 'threading' from 'C:\Anaconda2\Lib\threading.pyc'> ignored
Please help !