[IPython-dev] ipython1 saw exception transport and raising

Fernando Perez fperez.net at gmail.com
Wed Aug 15 03:43:37 EDT 2007


On 7/16/07, Doug Jones <dfj225 at gmail.com> wrote:

> As you see, some of the information that is part of the ArgumentError
> is either not transported or not displayed. Unlike last time, I don't
> really have any ideas as to why.

OK, I think I got it finally... Please svn up and let us know.  Here's
what I'm getting for simple tests:

ZeroDivisionError: integer division or modulo by zero
***************************************************************************
Exception in the IPython Engine.

Engine action that caused the error:

engine: 0
method: execute(lines)
lines =
import os
os.chdir('/home/fperez/ipython/test/ip1')
import err
err.bad()
#abd snytxx


Full traceback:
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)

/home/fperez/ipython/test/ip1/<string> in <module>()

/home/fperez/ipython/test/ip1/err.py in bad()
     14
     15 def bad():
---> 16     1/0
     17
     18 #bad()

ZeroDivisionError: integer division or modulo by zero
***************************************************************************

WARNING: Failure executing file: <tst.py>


Syntax errors are reported with a clumsy traceback:

SyntaxError: invalid syntax (line 5)
***************************************************************************
Exception in the IPython Engine.

Engine action that caused the error:

engine: 0
method: execute(lines)
lines =
import os
os.chdir('/home/fperez/ipython/test/ip1')
import err
err.bad()
abd snytxx


Full traceback:
---------------------------------------------------------------------------
SyntaxError                               Traceback (most recent call last)

/home/fperez/usr/lib/python2.5/site-packages/ipython1/core/interpreter.py
in split_commands(self, python)
    511         # Uncomment to help debug the ast tree
    512         # for n in ast.node:
--> 513         #     print n.lineno,'->',n
    514
    515         # Each separate command is available by iterating over
ast.node. The

/home/fperez/ipython/test/ip1/compiler/transformer.py in parse(buf, mode)
     50
     51
---> 52
     53
     54

/home/fperez/ipython/test/ip1/compiler/transformer.py in parsesuite(self, text)
    127
    128
--> 129
    130
    131

SyntaxError: invalid syntax (line 5)
***************************************************************************


WARNING: Failure executing file: <tst.py>


But the info is really  all there.   It's just that managing traceback
formatting across the network in this way is not particularly easy,
and I'm a bit too fried now to do more...

But at least now we are getting all the necessary info across, even if
for syntax errors the report isn't the nicest.

Cheers,

f



More information about the IPython-dev mailing list