<html>
<body>
You can get the line number info by using Dino's code (calling
sys.exc_info).&nbsp; Are you concerned that the default traceback display
doesn't show the line number?<br><br>
At 01:44 PM 8/21/2006, Matt Beckius wrote<br>
<blockquote type=cite class=cite cite="">No 32bit.&nbsp; I tried manually
setting the TraceBackSupport, but still got the same result:<br>
&nbsp;<br>
IronPython 1.0.60816 on .NET 2.0.50727.42<br>
Copyright (c) Microsoft Corporation. All rights reserved.<br>
&gt;&gt;&gt; import IronPython<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; IronPython.Compiler.Options.TraceBackSupport = True <br>
&gt;&gt;&gt; def Test():<br>
...&nbsp;&nbsp;&nbsp;&nbsp; print &quot;test&quot;<br>
...&nbsp;&nbsp;&nbsp;&nbsp; int(&quot;test&quot;)<br>
...<br>
&gt;&gt;&gt; Test()<br>
test<br>
Traceback (most recent call last):<br>
&nbsp; File , line 0, in &lt;stdin&gt;##12<br>
&nbsp; File , line 0, in Test <br>
ValueError: invalid integer number literal<br>
&gt;&gt;&gt;<br><br>
&nbsp;<br>
On 8/21/06, <b>Dino Viehland</b>
&lt;<a href="mailto:dinov@exchange.microsoft.com">
dinov@exchange.microsoft.com</a>&gt; wrote: <br>

<dl><br>

<dd>Are you running on a 64-bit machine w/ a 64-bit runtime?&nbsp; By
default we disable trackback support on 64-bit machines (we've hit a
unique bug w/ exception handling there), but it is enabled on 32-bit
machines and should work there. <br><br>

<dd>&nbsp;<br><br>

<dd>If I do:<br><br>

<dd>&nbsp;<br><br>

<dd>import sys<br><br>

<dd>def test2():<br><br>

<dd>&nbsp;&nbsp;&nbsp; try: test()<br><br>

<dd>&nbsp;&nbsp;&nbsp; except ValueError, ex:<br><br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global e<br><br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import sys<br><br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e =
sys.exc_info()<br><br>

<dd>&nbsp;<br><br>

<dd>test2()<br><br>

<dd>e<br><br>

<dd>&nbsp;<br><br>

<dd>&gt;&gt;&gt; e[2].tb_lineno<br><br>

<dd>2<br><br>

<dd>&gt;&gt;&gt; e[2].tb_frame.f_code.co_filename<br><br>

<dd>'&lt;stdin&gt;'<br><br>

<dd>&nbsp;<br><br>

<dd>You can enable on 64-bit:<br><br>

<dd>&nbsp;<br><br>

<dd>import IronPython <br><br>

<dd>IronPython.Compiler.Options.TraceBackSupport = True<br><br>

<dd>&nbsp;<br><br>

<dd>From:</b>
<a href="mailto:users-bounces@lists.ironpython.com">
users-bounces@lists.ironpython.com
</a>[<a href="mailto:users-bounces@lists.ironpython.com" eudora="autourl">
mailto:users-bounces@lists.ironpython.com</a>] On Behalf Of </b>Matt
Beckius<br>

<dd>Sent:</b> Monday, August 21, 2006 7:18 AM<br>

<dd>To:</b>
<a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a>
<br>

<dd>Subject:</b> [IronPython] Getting a line number of error (RC2)
<br><br>

<dd>&nbsp;<br><br>

<dd>Trying to get the line number of an error.&nbsp; CPython
produces:<br><br>

<dd>&nbsp;<br><br>

<dd>Python 2.4.2 (#67, Sep 28 2005, 12:41:11)<br>

<dd>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or
&quot;li<br>

<dd>&gt;&gt;&gt; def test():<br>

<dd>...&nbsp;&nbsp;&nbsp;&nbsp; print &quot;hi&quot;<br>

<dd>...&nbsp;&nbsp;&nbsp;&nbsp; int(&quot;hi&quot;)<br>

<dd>...<br>

<dd>&gt;&gt;&gt; test()<br>

<dd>hi<br>

<dd>Traceback (most recent call last):<br>

<dd>&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in ?<br>

<dd>&nbsp; File &quot;&lt;stdin&gt;&quot;, line 3, in test<br>

<dd>ValueError: invalid literal for int(): hi<br><br>

<dd>&nbsp;<br><br>

<dd>&nbsp;<br><br>

<dd>But IP RC2 produces:<br><br>

<dd>&nbsp;<br><br>

<dd>IronPython 1.0.60816 on .NET 2.0.50727.42<br>

<dd>Copyright (c) Microsoft Corporation. All rights reserved.<br>

<dd>&gt;&gt;&gt; def test():<br>

<dd>...&nbsp;&nbsp;&nbsp;&nbsp; print &quot;hi&quot;<br>

<dd>...&nbsp;&nbsp;&nbsp;&nbsp; int(&quot;hi&quot;)<br>

<dd>...<br>

<dd>&gt;&gt;&gt; test() <br>

<dd>hi<br>

<dd>Traceback (most recent call last):<br>

<dd>&nbsp; File , line 0, in &lt;stdin&gt;##5<br>

<dd>&nbsp; File , line 0, in test<br>

<dd>ValueError: invalid integer number literal<br><br>

<dd>&nbsp;<br><br>

<dd>How do I get the line number of this runtime error?&nbsp; <br><br>

<dd>&nbsp;<br><br>

<dd>MattB
</dl></blockquote></body>
<br>
<br>
J. Merrill / Analytical Software Corp</html>