also for all da C++ expurts
#include "Python/Python.h"
void importFunction(const char* file)
{
//std::cout << "0";
PyObject *pArgs, *pValue;
PyObject *pName, *pModule, *pFunc;
pName = PyString_FromString(file);
//std::cout << "1";
pModule = PyImport_Import(pName);
//std::cout << "2";
pFunc = PyObject_GetAttrString(pModule, "compMain");
//std::cout << "3";
if (pFunc && PyCallable_Check(pFunc))
{
//std::cout << "4";
pValue = PyObject_CallObject(pFunc,NULL);
//std::cout << "5";
}
//Py_XDECREF(pFunc);
//std::cout << pValue;
}
int main(int argc, char** argv)
{
printf("test");
//std::cout << "-3";
Py_Initialize();
//std::cout << "-2";
//PyRun_SimpleString("print 'Test'");
//PyRun_SimpleString("print str(3 + 5)");
//std::cout << "-1";
importFunction("test.py");
//std::cout << "6";
Py_Exit(0);
//std::cout << "7";
}
wtf i get a segmentation fault and when i uncomment the stds and include <iostream> none of them execute
wtf guys wat do!!!
when i uncomment the PyRun statements and comment everything else it works :(