[IronPython] Iron Python debuggin using PythonEngine

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 5 12:00:25 PDT 2008


Locals in methods will just show up.  Unfortunately everything else is still rough :(.  Module globals won't be easy to get to - if it's possible at all, they're static fields off in a weirdly named type.  Inspecting classes requires drilling into their dictionary objects.  For IronPython 2.0 Haibo had a blog entry which improves this for old-style classes - http://blogs.msdn.com/haibo_luo/archive/2007/08/03/4210344.aspx and that can probably be adapted for 1.x if someone was so inclined.  For new-style classes you'll see the bases members as normal .NET members.  One way to improve the experience is through __slots__ - in 1.x you should see them show up directly as fields/properties on the object.  And again for all other attributes you'll have to look in the dictionary.  So lots of the info you want is there it just takes some digging.

I guess the good news is that we've recently been hiring partially to fill this void.  The plan is to look at VS integration for both IronPython and IronRuby and make sure it's a good end-to-end experience.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Stephens
Sent: Thursday, June 05, 2008 9:51 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Iron Python debuggin using PythonEngine

That is great.. Now how do I get locals and a watch window running.  I installed PythonStudio hoping that would do the trick.  But alas I only get the ability to F10 through code which isnt that useful unless you can see what its doing.
On Thu, Jun 5, 2008 at 9:59 AM, Dino Viehland <dinov at exchange.microsoft.com<mailto:dinov at exchange.microsoft.com>> wrote:

Debugging needs to be globally enabled - but once it is ExecuteFile will produce debuggable code.  To globally enable debugging in 1.x you do:



            EngineOptions eo = new EngineOptions();

            eo.ClrDebuggingEnabled = true;

            PythonEngine eng = new PythonEngine(eo);



To create the PythonEngine.



From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Michael Stephens
Sent: Monday, June 02, 2008 10:01 PM
To: users at lists.ironpython.com<mailto:users at lists.ironpython.com>
Subject: [IronPython] Iron Python debuggin using PythonEngine



Hello all, This is my first post so bear with me!

My company is using iron python as an embedded scripting engine and we are loving every piece of it.  I just downloaded IronPython Studio and am working on making our scripts available to the studio for editing so we can get intellisense.  As a side project I wanted to see if I could get Iron Python to work with break points. In python studio I "ran without debugging" this piece of code.  It forced me to connect to vs2008 and allowed me to find my program.py file and debug it.

hello = "Hello VSX!!!"
import System
import System.Diagnostics
print hello
System.Diagnostics.Debugger.Launch()
System.Diagnostics.Debugger.Break()
print hello

The problem lies when i execute this file from the PythonEngine.  The code below is in c# and when executed prompts me to attach to C# program.cs not program.py .
            PythonEngine eng = new PythonEngine();
            eng.CreateModule();
            eng.Import("System");
            eng.Import("System.Diagnostics");
            eng.ExecuteFile(@"IronPython Studio\ConsoleApplication3\ConsoleApplication3\Program.py");

Does anyone have any ideas on how to get this to work.  I really love the idea of hosting ironpython in our application but we could definitely use the ability to get breakpoints.



--
Michael Stephens

Electrical Engineering Graduate Student
University of Wyoming
falcon at uwyo.edu<mailto:falcon at uwyo.edu> or 89iroc at gmail.com<mailto:89iroc at gmail.com>

_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



--
Michael Stephens

Electrical Engineering Graduate Student
University of Wyoming
falcon at uwyo.edu<mailto:falcon at uwyo.edu> or 89iroc at gmail.com<mailto:89iroc at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20080605/94c43761/attachment-0001.htm>


More information about the Users mailing list