Castrated traceback in sys.exc_info()

Pascal Chambon chambon.pascal at
Mon Mar 22 19:20:39 CET 2010

Gabriel Genellina a écrit :
> En Wed, 17 Mar 2010 09:42:06 -0300, Pascal Chambon 
> <chambon.pascal at> escribió:
>> traceback functions indeed allow the manipulation of exception 
>> tracebacks,
>> but the root problem is that anyway, since that traceback is incomplete,
>> your "traceback.format_exc().splitlines()" will only provide frames for
>> callee (downward) functions, not caller (upward) ones, starting from the
>> exception catching frame.
> Either I don't understand what you mean, or I can't reproduce it:

Allright, here is more concretely the problem :

import logging

def a(): return b()
def b(): return c()
def c():
        return d()
        logging.exception("An error")
def d(): raise ValueError

def main():

ERROR:root:An error
Traceback (most recent call last):
  File "C:/Users/Pakal/Desktop/", line 7, in c
    return d()
  File "C:/Users/Pakal/Desktop/", line 11, in d
    def d(): raise ValueError

As you see, the traceback only starts from function c, which handles the 
It doesn't show main(), a() and b(), which might however be (and are, in 
my case) critical to diagnose the severity of the problem (since many 
different paths would lead to calling c()).

So the question is : is that possible to enforce, by a way or another, 
the retrieval of the FULL traceback at exception raising point, instead 
of that incomplete one ?

Thank you for your help,


More information about the Python-list mailing list