7 using namespace boost::python;
8 PyObject *exc, *val, *
trace;
9 PyErr_Fetch(&exc,&val,&
trace);
10 handle<> hExc(allow_null(exc));
14 handle<> hVal(allow_null(val));
15 handle<> hTrace(allow_null(
trace));
17 object oTrace(hTrace);
22 handle<> hStringVal(PyObject_Str(oVal.ptr()));
23 object stringVal( hStringVal );
26 throw cms::Exception(iType) <<
"python encountered the error: "<< PyString_AsString(stringVal.ptr())<<
"\n";
28 throw cms::Exception(iType)<<
" unknown python problem occurred.\n";
41 "sys.path.append('./')\n"
43 "ROOT.gSystem.Load(\"libFWCoreFWLite\")\n"
44 "ROOT.AutoLibraryLoader.enable()\n"
45 "import libFWCorePython as edm\n")
48 using namespace boost::python;
52 <<
"failed to add libFWCorePython python module to python interpreter";
55 boost::python::handle<PyObject>(borrowed(PyImport_AddModule(const_cast<char *>(
"__main__"))))));
56 object main_namespace = main_module.attr(
"__dict__");
61 main_namespace.ptr()))));
void pythonToCppException(const std::string &iType)
friend class PythonManagerHandle
static PythonManagerHandle handle()
void initlibFWCorePython()