Monday, January 19, 2009

Debugging IronPython in Visual Studio

Ryan Brady has posted a great blog entry with step-by-step instructions on how to debug IronPython code with the Visual Studio debugger (unfortunately it requires Visual Studio Professional and so doesn't work with Visual Studio Express - although it is possible that you could get round it by building IronPython from source as part of your solution):
The steps he lists are (although if you go directly to his entry it has more detailed instructions along with pretty pictures):
  • Create a Python file to debug.
  • From Visual Studio, open the IronPython executable (ipy.exe). If it doesn’t do so for you, add the ipy.exe as an existing project.
  • From the Solution Explorer, right-click on Properties and set the Command Arguments property. Use “-D” to tell ipy.exe to create debugging output and add the full path to the script you made before.
  • Click Ok.
  • Open the script you created earlier in Visual Studio and place breakpoints as desired.
  • Run the script in debug mode (F5).
He also uses the "-i" option to "ipy.exe" to open an interactive session when you break into your Python script.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.