[Problem] Embedding Boost.Python as an interpreter

06/08/2014 19:53 NikM#1
Hi there :)
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);
}
test.py
Code:
print ("Hi")
I would be very kind if someone with some boost.python experience could help me :)
06/11/2014 02:25 +Yazzn#2
Versuch mal den absoluten Pfad anzugeben.