开发者

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!!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜