#include <boost/filesystem/operations.hpp>
#ifdef USE_PYTHON
#include <boost/python.hpp>
+namespace py = boost::python;
#endif
using namespace boost::filesystem;
#ifdef USE_PYTHON
if (opts.runAsPythonInterpeter) {
Py_Initialize();
- boost::python::object main_module((boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__")))));
- boost::python::object main_namespace = main_module.attr("__dict__");
+ py::object main_module((py::handle<>(py::borrowed(PyImport_AddModule("__main__")))));
+ py::object main_namespace = main_module.attr("__dict__");
- boost::python::handle<> ignored((PyRun_String(
+ py::handle<> ignored((PyRun_String(
//"from IPython.Shell import IPShellEmbed\n"
//"shell = IPShellEmbed(['mussa'], '')\n",
//"import mussa\n"
main_namespace.ptr(),
main_namespace.ptr())
));
- boost::python::object square = main_module.attr("square");
- int result = boost::python::extract<int>(square(3));
+ py::object square = main_module.attr("square");
+ int result = py::extract<int>(square(3));
std::cout << "C++ has " << result << std::endl;
PyRun_InteractiveLoop(stdin, "mussa");
} else
qFatal(e.what());
}
#ifdef USE_PYTHON
- catch (boost::python::error_already_set e) {
+ catch (py::error_already_set e) {
PyErr_Print();
}
#endif /* USE_PYTHON */