Home » Support » Index of All Documentation » Introduction for New Users » Wing IDE Tutorial » Tutorial: Debugging »
Another useful feature when working through complex bugs is Wing's ability to watch debug data values in a variety of ways. This is done with the Watch tool:

Watching Values
While still at the same exception in PrintAsHTML, right-click on the locals value news in the Stack Data tool. This will present you with the following options for watching the value over time:
Watch by Symbolic Path -- This causes Wing to look for the symbolic name news in the current stack frame whenever you are debugging. When you select this item, the Watch panel will be displayed with one item in it that reads:
news <list 0x40401eec>
(the object id will of course vary)
This is useful for quick access to values without digging through a long locals or globals list in the Stack Data view.
Since the watch makes sense across debug sessions, it will be remembered in the Watch tool until you clear it.
Watch by Direct Reference -- This causes Wing to keep a reference to this particular object instance (a list). It will be shown in the Watch tool as long as it exists. If the reference count for the object instance goes to zero, Wing will report <value not found>.
This is useful for watching a particular object while stepping through portions of code that may not hold a reference to it, or from which it is difficult to reach the referenced instance data.
Since object references aren't meaningful across debug sessions, these entries will be removed from the Watch tool as soon as the debug process terminates.
Watch by Parent Slot -- This combines the above two modes by keeping a reference to the parent of the selected value and looking up the sub-part of the value by symbolic name.
If you try this on event in locals, you are watching the value event within the particular locals dictionary, rather than event in the current stack frame.
This technique is more useful when working in object-oriented code where it can be used to watch particular attributes within a specific object instance.
Since the parent is tracked by object reference, these entries are also removed from the Watch tool as soon as the debug process ends its life.
Watch by Module Slot -- This option can be used to watch values within modules, by looking up the module by name in sys.modules and tracking the value symbolically. It is only available when right-clicking on values in the Modules tool, which will be discussed later.
Since these are meaningful across debug sessions, values watched by module will be retained in the Watch tool until they are removed by the user.
Watching Expressions
It is also possible to watch the value of any Python expression in the Watch panel. Just click on an empty part of the Watching column and type in the expression you wish to watch:

Try this now, while still stopped at the exception in PrintAsHTML, by entering this:
news[-1]
This will show the last item of news as long as there is one, or <undefined> or <error evaluating> if the value cannot be determined.
Expressions are remembered in the Watch tool across debug sessions, until they are removed by the user.
| « 1.6.2. Tutorial: Command Line Power Debugging | Table of Contents | 1.6.4. Tutorial: Other Debugger Features » |
