Im trying around with boost.python because i want to embed a pythoninterpreter to a program.
I already searched for good examples that show the usage but everything i find isnt very informative or just doesnt really work.
Running a simple script doesnt even work
Code:
int main (void)
{
Py_Initialize();
boost::python::object main_module = boost::python::import("__main__");
boost::python::object main_namespace = main_module.attr("__dict__");
boost::python::exec("print ('Hello World')", main_namespace);
boost::python::exec("print ('Hello World'[3:5])", main_namespace);
boost::python::exec("print ('.'.join(['1','2','3']))", main_namespace);
boost::python::exec_file("test.py", main_namespace, main_namespace); //<- bad boy :(
return (0);
}
Code:
print ("Hi")






