[IronPython] Exception.StackTrace gone?

Jonathan Jacobs korpse-ironpython at kaydash.za.net
Thu Feb 9 13:19:20 CET 2006


J. de Hooge wrote:
> Does anyone know why it fails, and, more important, how I still can 
> print a stack trace?

You could either use sys.exc_value or .clsException.StackTrace on 
Exception objects. I don't know if the latter is a reliable source.

 >>> import sys
 >>> try:
...   raise NotImplementedError
... except Exception, e:
...   print e.clsException.StackTrace
...   print '*****'
...   print sys.exc_value.StackTrace
...
    at IronPython.Runtime.Ops.Raise(Object type, Object value, Object 
traceback)
    at input##25(Frame )
*****
    at IronPython.Runtime.Ops.Raise(Object type, Object value, Object 
traceback)
    at input##25(Frame )
 >>>


Hope this helps.
-- 
Jonathan

When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
                 -- Rinzai, ninth century Zen master



More information about the Ironpython-users mailing list