<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Ah yeah, my roommate asked me the same
question.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>There’s absolutely no reason that I
shouldn’t be using the Python traceback library (and you should use it
too). I’m working on a tutorial for IronPython which I would like
to run “out of the box” (that is, not have the end user install
CPython as a dependency of the tutorial). This is the only reason I was
looking for a “pure” IronPython solution.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-Lee<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> users-bounces@lists.ironpython.com
[mailto:users-bounces@lists.ironpython.com] <b><span style='font-weight:bold'>On
Behalf Of </span></b>J. Merrill<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, July 13, 2006
10:22 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Getting
a call stack from an exception?</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Could someone explain to this interested observer what is missing when
the standard Python traceback functionality is used? Writing
IronPython-specific code that isn't specifically involved in interacting with
.Net seems against the "you can run the same Python code anywhere"
notion that I expect to see.<br>
<br>
Or did you mean "using the IronPython Engine" (aka "in pure C#
code") when you said "in pure IP"? The sample code, after
all, was Python and not calls to the IronPython Engine....<br>
<br>
At 04:46 PM 7/12/2006, Dino Viehland wrote<br>
<br>
<br>
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>It shouldn’t be too hard to just get the line numbers &
filenames – the nice thing that the standard traceback.py file gives you
is it can get the lines of source code and include it in the displayed call
stack as well.<br>
<br>
<b><span style='font-weight:bold'>From:</span></b> Lee Culver<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, July 12, 2006
1:39 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Getting
a call stack from an exception?<br>
<br>
I’m probably going to just reimplement the functionality in pure
IP. If I get anywhere with it I’ll post it up here.<br>
<o:p></o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'>From:</span></font></b> Alex
Henderson<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, July 12, 2006
1:37 PM<br>
<b><span style='font-weight:bold'>To:</span></b> '<st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName>'<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Getting
a call stack from an exception?<br>
<br>
I would be interested to know how you get on with this problem Lee - I’ve
got the same issue myself.<br>
<br>
Chez,<br>
<br>
- Alex<br>
<o:p></o:p></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'>From:</span></font></b> Lee Culver<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, 13 July 2006 6:57
a.m.<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Getting
a call stack from an exception?<br>
<br>
Yikes. I was hoping for a way to do it in pure IronPython. Thanks
though.<br>
<o:p></o:p></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'>From:</span></font></b> Dino Viehland<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, July 12, 2006
11:54 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Getting
a call stack from an exception?<br>
<br>
Tracebacks are the correct way to do this, I recommend you install the standard
Python library against IronPython to make this really useful – then you
can do import traceback and use its handy functions (otherwise you’ll be
walking the traceback list in sys.exc_info() which won’t be much fun).<br>
<br>
<b><span style='font-weight:bold'>From:</span></b> Lee Culver<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, July 12, 2006
11:49 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> [IronPython] Getting a
call stack from an exception?<br>
<br>
I would like to print out a call stack from an exception object, much like what
the IronPython console does when an exception goes uncaught. I have tried
doing something like this:<br>
<br>
try:<br>
… #something that causes an exception<br>
except Exception, e:<br>
print e<br>
<br>
But, like python, this only prints out the message given to it. I have
also tried this:<br>
print e.clsException<br>
print e.clsException.StackTrace<br>
<br>
But these print out the stack trace which includes the IronPython library c#
code as well. Is there a way to get the stack trace which only contains
the python call stack (like the one the console uses)?<br>
<br>
Thanks<br>
-Lee<o:p></o:p></p>
</div>
</body>
<br>
<br>
J. Merrill / Analytical Software Corp
</html>