Stephen Walton wrote:
> While working on the above, I found that cutting and pasting output from
> IPython inevitably made the document a lot longer because of the
> traceback. How would people feel if I turned off that traceback for
> user documentation examples? It can be a bit hard to find the actual
> error message in the traceback, especially in documentation where the
> colored text doesn't appear.
Note that ipython has an exception mode called 'plain', which formats the
exceptions much like plain python, giving a far more compact output.
Perhaps you could use this for the docs. It might be a good idea to show a
full traceback once or twice, indicating that in real life use the long modes
are probably the most informative, but that for the sake of documentation
brevity the plain mode will be used in the examples.
An example follows.
Best,
f
In [2]: run error.py
hi
Ramp time: 0.0
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/usr/local/home/fperez/test/error.py
109
110 print 'speedup:',Rtime/RNtime
111
112
--> 113 if __name__ == '__main__': main()
/usr/local/home/fperez/test/error.py in main()
104 array_num = zeros(size,'d')
105 for i in xrange(reps):
--> 106 RampNum(array_num, size, 0.0, 1.0)
107 RNtime = time.clock()-t0
108 print 'RampNum time:', RNtime
/usr/local/home/fperez/test/error.py in RampNum(result, size, start, end)
88 tmp = zeros(1e2)
89 step = (end-start)/(size-1-tmp)
---> 90 result[:] = arange(size)*step + start
91
92 def main():
ValueError: frames are not aligned
WARNING: Failure executing file: <error.py>
In [3]: xmode plain
Exception reporting mode: Plain
In [4]: run error.py
hi
Ramp time: 0.0
------------------------------------------------------------
Traceback (most recent call last):
File "error.py", line 113, in ?
if __name__ == '__main__': main()
File "error.py", line 106, in main
RampNum(array_num, size, 0.0, 1.0)
File "error.py", line 90, in RampNum
result[:] = arange(size)*step + start
ValueError: frames are not aligned
WARNING: Failure executing file: <error.py>