<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:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EstiloCorreioElectrnico18
        {mso-style-type:personal-reply;
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=PT link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='color:black'>Those classes probably won&#8217;t
be triggered unless I execute the code.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>Consider this sample code:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>import sys,clr<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>clr.AddReference(&#8220;System.Windows.Forms&#8221;)<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>from System.Windows.Forms
import *<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>frm = Form()<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>frm.Show()<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>&#8230;#some error here,
after the show<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>If I execute the code
the form will still be shown and only then I would be able to catch the error.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>What I want is to catch
the errors without showing the form (considering this code).<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'>Thanks for your
cooperation<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:black'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p>&nbsp;</o:p></span></p>

</div>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'>Don't you think PythonException
or related classes would be sufficient?<o:p></o:p></p>

<div>

<p class=MsoNormal>On Fri, Jan 23, 2009 at 7:14 PM, Ant๓nio Piteira &lt;<a
href="mailto:antonio.piteira@wtvision.com">antonio.piteira@wtvision.com</a>&gt;
wrote:<o:p></o:p></p>

<div>

<div>

<p><span lang=EN-US style='color:black'>I get it, I'm not really
surprised&#8230; I was hoping that maybe there was a way to use </span><span
lang=EN-US>s</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>criptSource.Compile(options,errorTracker),
</span><span lang=EN-US>or something like that, and get the errors from </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>errorTracker </span><span
lang=EN-US>or some kind of sink.</span><o:p></o:p></p>

<p><span lang=EN-US>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US>Very much apreciated for your time.</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span style='color:black'>ญญญญญญญญญญญญญญญญญญ___________________________________________________________________________________________________________________</span><o:p></o:p></p>

<div>

<div>

<p><span lang=EN-US style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US>Are you familiar with &quot;the halting problem&quot;? :) (</span><a
href="http://en.wikipedia.org/wiki/Halting_problem" target="_blank"><span
lang=EN-US>http://en.wikipedia.org/wiki/Halting_problem)</span></a><o:p></o:p></p>

</div>

<div>

<p><span lang=EN-US>&nbsp;</span><o:p></o:p></p>

</div>

<div>

<p>The only reliable way to find if a particular program returns a runtime
error is to execute the program. &nbsp;For limited, targeted cases, (such as
importing modules) you could write an analyzer program which would be *often*
right -- but I could create a program &nbsp;that tricks your analyzer into
reporting a problem where none exists. &nbsp;Consider this:<o:p></o:p></p>

</div>

<div>

<p>&nbsp;<o:p></o:p></p>

</div>

<div>

<p>import sys<o:p></o:p></p>

</div>

<div>

<p>sys.modules['foo'] = type(sys)('foo')<o:p></o:p></p>

</div>

<div>

<p>import foo<o:p></o:p></p>

</div>

<div>

<p>&nbsp;<o:p></o:p></p>

</div>

<div>

<p>Your static analyzer would have a tough time recognizing that this program
would not raise a runtime error.<o:p></o:p></p>

</div>

<p><span style='color:black'>&nbsp;</span><o:p></o:p></p>

</div>

<p><span lang=EN-US style='color:black'>ญญญญญญญญญญญญญญญญญญ___________________________________________________________________________________________________________________</span><o:p></o:p></p>

<div>

<p><span lang=EN-US>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US>Those things are run-time errors (failed imports et al).
You would</span><o:p></o:p></p>

<p><span lang=EN-US>possibly look at the parse tree for any imports and
determine if the</span><o:p></o:p></p>

<p><span lang=EN-US>modules to be imported exist, but that sounds like a lot of
trouble :)</span><o:p></o:p></p>

<p><span lang=EN-US>&nbsp;</span><o:p></o:p></p>

<p>slide<o:p></o:p></p>

</div>

<p><span style='color:black'>ญญญญญญญญญญญญญญญญญญ___________________________________________________________________________________________________________________</span><o:p></o:p></p>

<div>

<p><span style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span style='color:black'>&nbsp;</span><o:p></o:p></p>

<div>

<p>On Fri, Jan 23, 2009 at 8:45 AM, Ant๓nio Piteira &lt;<a
href="mailto:antonio.piteira@wtvision.com" target="_blank">antonio.piteira@wtvision.com</a>&gt;
wrote:<o:p></o:p></p>

<div>

<div>

<p><span lang=EN-US style='color:black'>Hi,</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>I'm trying get all runtime errors
without actually executing the code. I can get all syntax errors using the
parser, but runtime errors like &quot;import ys&quot; and stuff like that I',
not able to.</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>Is there any way to do this?</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>&nbsp;</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>Thanks,</span><o:p></o:p></p>

<p><span lang=EN-US style='color:black'>Vision</span><o:p></o:p></p>

</div>

</div>

<p style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"
target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></p>

</div>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"
target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br clear=all>
<br>
-- <br>
<a href="http://nomadlife.org">nomadlife.org</a><o:p></o:p></p>

</div>

</div>

</body>

</html>