Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iron Python and VS2010 debugging woes

I'm starting to use IronPython and VS2010 and I'm having trouble with the debugging environment... can anyone point me in the right direction? Note that my python knowledge is less than a week old so my problems could well be self inflicted.

The most annoying problem is that when an exception occurs the VS debugger doesn't break where the exception occurred... but rather it seems to break at the very top level. This makes figuring out where the exception occurred a frustrating exercise of breakpointing and stepping.

Another annoyance is raising custom exceptions. The debugger only tells me the class name of the exception and not the message (but native iron python exceptions include both). For example:

class MyCustomError(BaseException):
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)

When raised (eg "raise MyCustomError('some nice message')") all I can see in the debugger for $exception is "MyCustomError".... when I'd really like to see not only the class name but also the value.

Any help would be appreciated!!

like image 751
user505765 Avatar asked Oct 10 '22 17:10

user505765


1 Answers

If you install Python Tools for Visual Studio you can get Python debugging instead of .NET debugging. Just go into project properties on the Debug page and select the Python launch mode. Then you can configure exceptions in the debug exceptions window.

Without PTVS you can possibly improve your exception experience by going into the exceptions window and making sure that .NET exceptions are checked for the thrown column.

like image 118
Dino Viehland Avatar answered Oct 13 '22 09:10

Dino Viehland