[Ironpython-users] Options for debugger for DLR languages on Mono
dinov at microsoft.com
Tue Sep 27 04:35:14 CEST 2011
Is the hosted IronPython running in the same ScriptEngine or a different one?
If it's a different one you'll need to do the settrace on the other ScriptEngine but
you should be able to do that from Python code as well.
If it's the same then I would expect that you'd see the traces for both the hosting
and hosted code (I'd also consider separating it into 2 different engines so that
you should only see the traces for the hosted code, or you could look at the args
and see if it's the hosting code and ignore it). But if they're the same and you're
not getting the trace events for the hosted code then that could be a bug.
> -----Original Message-----
> From: ironpython-users-
> bounces+dinov=exchange.microsoft.com at python.org [mailto:ironpython-
> users-bounces+dinov=exchange.microsoft.com at python.org] On Behalf Of
> Doug Blank
> Sent: Monday, September 26, 2011 10:25 AM
> To: Dino Viehland
> Cc: ironpython-users at python.org
> Subject: Re: [Ironpython-users] Options for debugger for DLR languages on
> On Mon, Sep 26, 2011 at 12:54 PM, Dino Viehland <dinov at microsoft.com>
> > Do you have a using statement for IronPython.Hosting? If you add that
> > you should get the extension method showing up on ScriptEngine.
> I'm using IronPython as the hosting language... does that mean I just can't
> get the extensions?
> But in any event, is this workaround:
> > As for tracing the hosting level - can you describe what you mean? Do
> > you have additional hosting code written in Python?
> Yes, all of the hosting code is written in IronPython. When I use the
> workaround above, I get tracing but at my IronPython hosting app level, not
> at the level of my script being run. The only way I can get tracing in my
> Python script being executed, is by having the set_trace inside that file.
> I'm trying to find a way that I can from outside that script (eg, from the
> IronPython hosting app) get tracing on. I can probably write some of this in
> C# if I need to, but all of the hosting app is written in IronPython at the
> > -----Original Message-----
> > From: Doug Blank [mailto:doug.blank at gmail.com]
> > Sent: Saturday, September 24, 2011 5:47 PM
> > To: Dino Viehland; ironpython-users at python.org
> > Subject: Re: [Ironpython-users] Options for debugger for DLR languages
> > on Mono
> > On Sat, Sep 24, 2011 at 5:09 PM, Dino Viehland <dinov at microsoft.com>
> >> You should be able to do engine.GetSysModule().settrace(func) and
> >> then do the Execute call (this is using C# dynamic to invoke settrace).
> >> GetSysModule is an extension method in IronPython.Hosting.
> > I didn't see GetSysModule for some reason in IronPython 2.7....
> > perhaps a Mono issue, or maybe I'm not importing it correctly?
> > But I was able to:
> > IronPython.Hosting.Python.GetSysModule(engine).settrace(trace)
> > source = engine.CreateScriptSourceFromFile(filename)
> > source.Compile()
> > source.Execute(scope)
> > However, it ended up tracing the hosting level, rather than the source. Is
> that an IronPython issue? Or user error? Is there another way to inject a
> trace in an execution?
> > -Doug
> >>> -----Original Message-----
> >>> From: ironpython-users-
> >>> bounces+dinov=exchange.microsoft.com at python.org
> >>> users-bounces+dinov=exchange.microsoft.com at python.org] On Behalf
> >>> Doug Blank
> >>> Sent: Saturday, September 24, 2011 10:48 AM
> >>> To: Dino Viehland
> >>> Cc: ironpython-users at python.org
> >>> Subject: Re: [Ironpython-users] Options for debugger for DLR
> >>> languages on Mono
> >>> Use of sys.settrace (especially with the bdb.py) makes the Python
> >>> debugger really easy. However, I'm having one little issue: I want
> >>> to set the trace from outside the running code. Currently, I'm running a
> Python file like this:
> >>> source = engine.CreateScriptSourceFromFile(filename)
> >>> source.Compile()
> >>> source.Execute(manager.scope)
> >>> I have a bdb-based debugger that works it I put it the the file, but
> >>> I can't figure out how to inject it into the Execution. For example, if I
> have in the file:
> >>> d.set_trace()
> >>> x = 1
> >>> I can trace that. But if I take out the "d.set_trace()" and execute
> >>> it any other way in the same scope, it doesn't work.
> >>> How can I get code to run as it it were in the file? Any ideas appreciated!
> >>> -Doug
> >>> _______________________________________________
> >>> Ironpython-users mailing list
> >>> Ironpython-users at python.org
> >>> http://mail.python.org/mailman/listinfo/ironpython-users
> Ironpython-users mailing list
> Ironpython-users at python.org
More information about the Ironpython-users