CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_2_9/src/FWCore/Python/src/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(), edm::pythonFileToConfigure(), PythonFilter::PythonFilter(), PythonProcessDesc::read(), edm::readPSetsFrom(), and FWPathsPopup::scheduleReloadEvent().

    {
       using namespace boost::python;
       PyObject *exc, *val, *trace;
       PyErr_Fetch(&exc,&val,&trace);
       handle<> hExc(allow_null(exc));
       if(hExc) {
          object oExc(hExc);
       }
       handle<> hVal(allow_null(val));
       handle<> hTrace(allow_null(trace));
       if(hTrace) {
          object oTrace(hTrace);
       }

       if(hVal) {
          object oVal(hVal);
          handle<> hStringVal(PyObject_Str(oVal.ptr()));
          object stringVal( hStringVal );

          //PyErr_Print();
          throw cms::Exception(iType) <<"python encountered the error: "<< PyString_AsString(stringVal.ptr())<<"\n";
       } else {
          throw cms::Exception(iType)<<" unknown python problem occurred.\n";
       }
    }