I use this code: from Microsoft.Scripting.Hosting import ExceptionOperations from IronPython.Hosting import Python engine = Python.CreateEngine() exc_service = engine.GetService[ExceptionOperations]() traceback = exc_service.FormatException(e.clsException)
-Dan On Tue, Jan 13, 2009 at 10:43 PM, Laurion Burchall <[email protected]> wrote: > I'm upgrading our internal test framework from IronPython 1.X to 2.X. > Getting a good stack trace from an exception is eluding me. The old code > looks like this: > > try: > # runs the test > except Exception, e: > failCount += 1 > PrintTestOutcome(testCount, False, testFullName, e.ToString()) > What is the 2.X equivalent? By default e.ToString() gives the ugly 'real' > callstack. In a test program e.clsException did the right thing, but that > only appears sometimg (if System is imported?) and when used in the test > framework gave the .NET callstack instead of line number in Python scripts. > > Any suggestions? > > thanks, > --Laurion > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
