On Sat, Sep 24, 2011 at 5:09 PM, Dino Viehland <[email protected]> wrote: > 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- >> [email protected] [mailto:ironpython- >> [email protected]] On Behalf Of >> Doug Blank >> Sent: Saturday, September 24, 2011 10:48 AM >> To: Dino Viehland >> Cc: [email protected] >> 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 >> [email protected] >> http://mail.python.org/mailman/listinfo/ironpython-users > > _______________________________________________ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
