The example1.py program you have just created connects to python.org via HTTP, reads and parses the Python-related news feed in RDF format, and then prints the most recent five items as text and HTML. Don't worry if you are working offline. 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 left-most 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 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 the size of your screen or if you have altered the toolbar's configuration. 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. ReadPythonNews is a good function to step through in order to try out the basic debugger features covered above.
|« 1.6. Tutorial: Navigating Code||Table of Contents||1.7.0. Tutorial: Debug I/O »|
1.7.0. Tutorial: Debug I/O
1.7.1. Tutorial: Debug Process Exception Reporting
1.7.2. Tutorial: Interactive Debugging
1.7.3. Tutorial: Execution Environment
1.7.4. Tutorial: Remote Debugging
1.7.5. Tutorial: Other Debugger Features