CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
PythonManager.cc File Reference
#include "PythonManager.h"
#include "FWCore/Utilities/interface/Exception.h"

Go to the source code of this file.

Functions

void pythonToCppException (const std::string &iType)
 

Function Documentation

void pythonToCppException ( const std::string &  iType)

Definition at line 5 of file PythonManager.cc.

Referenced by PythonFilter::filter(), PythonService::postBeginJob(), PythonService::postEndJob(), PythonService::postProcessEvent(), PythonFilter::PythonFilter(), and edm::readPSetsFrom().

6  {
7  using namespace boost::python;
8  PyObject *exc, *val, *trace;
9  PyErr_Fetch(&exc,&val,&trace);
10  handle<> hExc(allow_null(exc));
11  if(hExc) {
12  object oExc(hExc);
13  }
14  handle<> hVal(allow_null(val));
15  handle<> hTrace(allow_null(trace));
16  if(hTrace) {
17  object oTrace(hTrace);
18  }
19 
20  if(hVal) {
21  object oVal(hVal);
22  handle<> hStringVal(PyObject_Str(oVal.ptr()));
23  object stringVal( hStringVal );
24 
25  //PyErr_Print();
26  throw cms::Exception(iType) <<"python encountered the error: "<< PyString_AsString(stringVal.ptr())<<"\n";
27  } else {
28  throw cms::Exception(iType)<<" unknown python problem occurred.\n";
29  }
30  }
double trace(const ROOT::Math::SMatrix< double, N, N > &matrix)