<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>&nbsp;</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&#8217;s absolutely no reason that I
shouldn&#8217;t be using the Python traceback library (and you should use it
too).&nbsp; I&#8217;m working on a tutorial for IronPython which I would like
to run &#8220;out of the box&#8221; (that is, not have the end user install
CPython as a dependency of the tutorial).&nbsp; This is the only reason I was
looking for a &#8220;pure&#8221; 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>&nbsp;</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>&nbsp;</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>&nbsp;</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?&nbsp; Writing
IronPython-specific code that isn't specifically involved in interacting with
.Net seems against the &quot;you can run the same Python code anywhere&quot;
notion that I expect to see.<br>
<br>
Or did you mean &quot;using the IronPython Engine&quot; (aka &quot;in pure C#
code&quot;) when you said &quot;in pure IP&quot;?&nbsp; 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&#8217;t be too hard to just get the line numbers &amp;
filenames &#8211; 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>
&nbsp;<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>
&nbsp;<br>
I&#8217;m probably going to just reimplement the functionality in pure
IP.&nbsp; If I get anywhere with it I&#8217;ll post it up here.<br>
&nbsp;<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>
&nbsp;<br>
I would be interested to know how you get on with this problem Lee - I&#8217;ve
got the same issue myself.<br>
&nbsp;<br>
Chez,<br>
&nbsp;<br>
&nbsp; - Alex<br>
&nbsp;<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>
&nbsp;<br>
Yikes.&nbsp; I was hoping for a way to do it in pure IronPython.&nbsp; Thanks
though.<br>
&nbsp;<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>
&nbsp;<br>
Tracebacks are the correct way to do this, I recommend you install the standard
Python library against IronPython to make this really useful &#8211; then you
can do import traceback and use its handy functions (otherwise you&#8217;ll be
walking the traceback list in sys.exc_info() which won&#8217;t be much fun).<br>
&nbsp;<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>
&nbsp;<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.&nbsp; I have tried
doing something like this:<br>
&nbsp;<br>
try:<br>
&nbsp;&nbsp;&nbsp; &#8230; #something that causes an exception<br>
except Exception, e:<br>
&nbsp;&nbsp;&nbsp; print e<br>
&nbsp;<br>
But, like python, this only prints out the message given to it.&nbsp; I have
also tried this:<br>
&nbsp;&nbsp;&nbsp; print e.clsException<br>
&nbsp;&nbsp;&nbsp; print e.clsException.StackTrace<br>
&nbsp;<br>
But these print out the stack trace which includes the IronPython library c#
code as well.&nbsp; Is there a way to get the stack trace which only contains
the python call stack (like the one the console uses)?<br>
&nbsp;<br>
Thanks<br>
-Lee<o:p></o:p></p>

</div>

</body>

<br>
<br>
J. Merrill / Analytical Software Corp
</html>