[IronPython] IronPython 2.0 Errors...

Dody Gunawinata empirebuilder at gmail.com
Fri Jan 23 19:31:40 CET 2009


There may be a way to execute the show form without actually displaying it
to the user - there must be some AppDomain magic available to be used
somewhere.
The code needs to be executed one way or another and what you are suggesting
I think falls into the static verifier category which is a whole another
ballgame.

On Fri, Jan 23, 2009 at 8:19 PM, António Piteira <
antonio.piteira at wtvision.com> wrote:

>  Those classes probably won't be triggered unless I execute the code.
>
>
>
> Consider this sample code:
>
>
>
> import sys,clr
>
> clr.AddReference("System.Windows.Forms")
>
> from System.Windows.Forms import *
>
>
>
> frm = Form()
>
> frm.Show()
>
>
>
> …#some error here, after the show
>
>
>
> If I execute the code the form will still be shown and only then I would be
> able to catch the error.
>
> What I want is to catch the errors without showing the form (considering
> this code).
>
>
>
> Thanks for your cooperation
>
>
>
>
>
>
>
>
>
> Don't you think PythonException or related classes would be sufficient?
>
> On Fri, Jan 23, 2009 at 7:14 PM, António Piteira <
> antonio.piteira at wtvision.com> wrote:
>
> I get it, I'm not really surprised… I was hoping that maybe there was a way
> to use scriptSource.Compile(options,errorTracker), or something like that,
> and get the errors from errorTracker or some kind of sink.
>
>
>
> Very much apreciated for your time.
>
>
>
>
> ­­­­­­­­­­­­­­­­­­___________________________________________________________________________________________________________________
>
>
>
>
>
> Are you familiar with "the halting problem"? :) (
> http://en.wikipedia.org/wiki/Halting_problem)<http://en.wikipedia.org/wiki/Halting_problem>
>
>
>
> The only reliable way to find if a particular program returns a runtime
> error is to execute the program.  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  that tricks your analyzer
> into reporting a problem where none exists.  Consider this:
>
>
>
> import sys
>
> sys.modules['foo'] = type(sys)('foo')
>
> import foo
>
>
>
> Your static analyzer would have a tough time recognizing that this program
> would not raise a runtime error.
>
>
>
>
> ­­­­­­­­­­­­­­­­­­___________________________________________________________________________________________________________________
>
>
>
> Those things are run-time errors (failed imports et al). You would
>
> possibly look at the parse tree for any imports and determine if the
>
> modules to be imported exist, but that sounds like a lot of trouble :)
>
>
>
> slide
>
>
> ­­­­­­­­­­­­­­­­­­___________________________________________________________________________________________________________________
>
>
>
>
>
> On Fri, Jan 23, 2009 at 8:45 AM, António Piteira <
> antonio.piteira at wtvision.com> wrote:
>
> Hi,
>
>
>
> 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 "import
> ys" and stuff like that I', not able to.
>
> Is there any way to do this?
>
>
>
> Thanks,
>
> Vision
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> --
> nomadlife.org
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


-- 
nomadlife.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090123/234103fb/attachment.html>


More information about the Ironpython-users mailing list