[IronPython] Parsing Stack Traces

Dino Viehland dinov at exchange.microsoft.com
Wed Feb 13 23:14:42 CET 2008


Ahh, in that case the class to subclass is ErrorSink instead of CompilerSink :)  Once you have an error sink you can call:

ScriptEngine.Compile(source, compilerOptions, errorSink)

And your sink should get notified of the errors.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide
Sent: Wednesday, February 13, 2008 1:54 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Parsing Stack Traces

I am using the 2.0 hosting APIs. I'll look around some more in the
code. I have a situation which works now using FormatException that
should work ok.

thanks

slide

On Feb 13, 2008 2:23 PM, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> Are you using the Python code dom provider from 1.x or directly interacting w/ the hosting APIs?  I think you should get a list of errors like you'd normally get w/ CodeDom - although it'll probably only include 1 error (but it should have line info).
>
> Otherwise in 1.x you can subclass the CompilerSink class and set your own sink on PythonCompiler and have all the errors provided to you.  When AddError on the sink gets called you'll get a CodeSpan and the text of the line.
>
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide
> Sent: Tuesday, February 12, 2008 3:53 PM
> To: Discussion of IronPython
> Subject: [IronPython] Parsing Stack Traces
>
> I have a current script engine I wrote which deals with CodeDom for
> JScript.NET scripts and I am currently adding Python capabilities to
> it. On the JScript.NET side, I can get the CompilerErrors from the
> CompileResults after I've compiled and run the main entry point of the
> script. On the Python side, when I run it, I get
> SyntaxErrorExceptions, etc that I would like to turn into something
> like a CompilerError object. I wrote my own object that is very
> similar to CompilerError so that I could abstract this out. Is there a
> way to get the line number, column number, etc from the Python engine
> so I could fill these items in?
>
> Thanks
>
> --
> slide-o-blog
> http://slide-o-blog.blogspot.com/
> _______________________________________________
> 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
>



--
slide-o-blog
http://slide-o-blog.blogspot.com/
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list