In case you haven't already figured it out, the example1.py program you have created connects to python.org via HTTP, reads and parses the Python-related news feed that is hosted there, and then prints the most recent five items as text and HTML. Don't worry if you don't have an internet connection on your machine; the script has canned data it will use when it cannot connect to python.org.
To start debugging, set a breakpoint on the line that reads return 5 in the GetItemCount function. This can be done by clicking on the line and selecting the Break toolbar item, or by clicking on the dark margin to the left of the line. The breakpoint should appear as a filled red circle:
Next start the debugger with the green arrow icon in the toolbar or the Start/Continue item in the Debug menu. Wing will show the Debug Properties dialog with the properties that will be used during the debug run. Just ignore this for now, uncheck the Show this dialog before each debug run checkbox at the bottom, and press OK.
Wing will run to the breakpoint and stop, placing a red indicator on the line. Notice that the toolbar changes to include additional debug tools, as shown below:
Your display may vary depending on how you have configured the Toolbar Size and Toolbar Style preferences. Note that Wing displays tooltips explaining what the tools do when you mouse over them.
Now you can inspect the program state at that point with the Stack Data tool and by going up and down the stack from the toolbar or Debug menu. The stack can also be viewed as a list using the Call Stack tool.
Notice that the Debug status indicator in the lower left of Wing's main window changes color depending on the state of the debug process. Mouse over the indicator to see detailed status in a tooltip:
Next, try stepping out to the enclosing call to ReadPythonNews. In this particular context, you can achieve this in a single click with the Step Out toolbar icon or Debug menu item (two clicks on Step Over also work). This is a good function to step through in order to familiarize yourself with the basic debugger features covered above.
|« 1.5. Tutorial: Introduction to the Editor||Table of Contents||1.6.0. Tutorial: Debug I/O »|
1.6.0. Tutorial: Debug I/O
1.6.1. Tutorial: Debug Process Exception Reporting
1.6.2. Tutorial: Command Line Power Debugging
1.6.3. Tutorial: Watching Debug Data
1.6.4. Tutorial: Other Debugger Features