Exceptions with TPySelector


I am working with TPySelector and I would like to know if there is a way to get back the detailed exception thrown by python with line numbers and the exact piece of code that causes it. What I get looks like:

Info in <TPySelector::AbortProcess>: 'ZeeNtupleSelector' object has no attribute 'fout' Traceback (most recent call last): File "../python/run_selector.py", line 33, in <module> run_selector(selector + 'Selector', inputfiles, **vars(options) ) File "/Users/blenzi/Workarea/Calib/egammaCalibUtils/python/egCalibUtils.py", line 82, in run_selector chain.Process('TPySelector', selector.__name__, Nevents) TypeError: none of the 2 overloaded methods succeeded. Full details: 'ZeeNtupleSelector' object has no attribute 'fout' Long64_t TTree::Process(void* selector, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0) => could not convert argument 1

Thanks a lot,


should be in the Process method that is overridden in the TPySelector derived class. Basically where the traceback gets “eaten,” is after the call to that method: only the (final) exception itself gets propagated through the C++ code (to be collected with other exceptions in the general overload resolution code), not the whole traceback that exists at that time.

Maybe it’s an option to wrap the whole of Process internals into a try/except and either printing the traceback in except (using “import traceback; traceback.print_exc()”), or starting pdb (by doing “import pdb; pdb.set_trace()”) in there.


Hi Wim,

Thanks a lot, the traceback trick works perfectly.