Traceback not going all the way to the exception?

Aaron "Castironpi" Brady castironpi at gmail.com
Thu Oct 9 21:23:21 CEST 2008


On Oct 9, 3:27 am, sert <je... at hotmail.com> wrote:
> I just got an exception and the traceback wouldn't go all the
> way to the statement that threw the exception. I found that out
> by using the debugger.
>
> Contrast the traceback:
>
> http://tinyurl.com/5xglde
>
> with the debugger output (notice the arrow pointing to the last
> statement the traceback showed and how the execution went on
> beyond it):
>
> http://tinyurl.com/3fjgrl
>
> Is this a known issue or should I submit a bug report?

Could be you are re-raising an exception by hand instead of with the
bare 'raise' statement.  Notice the difference in tracebacks shown
here:

>>> def f():
...     try:
...             g()
...     except Exception, e:
...             raise e
...
>>> def g():
...     raise Exception("abc")
...
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in f
Exception: abc
>>> def f():
...     try:
...             g()
...     except Exception, e:
...             raise
...
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in f
  File "<stdin>", line 2, in g
Exception: abc
>>>



More information about the Python-list mailing list