| prev | Version 1107 (Mon Nov 27 20:46:02 2006) | next |
WingIDE in this lecture![[A Debugger in Action]](./img/debugging/debugger_in_action.png)
Figure 13.1: A Debugger in Action
![[Source Browser]](./img/debugging/source_browser.png)
Figure 13.2: Source Browser
![[Code Assistant]](./img/debugging/code_assistant.png)
Figure 13.3: Code Assistant
Microsoft Visual Studio on WindowsEclipseGDBpdbpdb.set_trace() inside a programimport pdb base = "Na" pdb.set_trace() acid = "Cl" salt = base + acid print salt
$ python lec/inc/debugging/set_trace.py> /swc/lec/inc/debugging/set_trace.py(7)?()-> acid = "Cl"(Pdb) n> /swc/lec/inc/debugging/set_trace.py(8)?()-> salt = base + acid(Pdb) n> /swc/lec/inc/debugging/set_trace.py(9)?()-> print salt(Pdb) nNaCl--Return--
![[Inspecting Values]](./img/debugging/inspecting_values.png)
Figure 13.4: Inspecting Values
2*x<0, debugger displays False![[Programs As Data]](./img/debugging/programs_as_data.png)
Figure 13.5: Programs As Data
HALT instruction![[Creating a Breakpoint]](./img/debugging/setting_breakpoint.png)
Figure 13.6: Creating a Breakpoint
HALT instruction, it signals the debuggerHALT once againmax_temp to -1)time_spent_waiting to 600 seconds in debugger than to pull out the network cable and wait…NoneDEBUG: only want to see it when debugging a problemINFO: information about normal operationsWARNING: something that a human being should pay attention toERROR: something has gone wrong inside the softwareCRITICAL: something has gone very wrong inside the softwareWARNING-level messages and above in a fileimport logging
logging.basicConfig(level=logging.WARNING,
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%Y-%b-%d %H:%M:%S',
filename='logging_example.out',
filemode='w')
logging.debug('Last file opened: %s', datafile)
logging.info('User %s logged in normally on %s', user_id, machine_name)
logging.warning('%s attempted to log in as %s', villain, user_id)
logging.error('No such spell (spell ID %04d)', spell_id)
logging.critical('Failed to cast %s', curse)
2006-Feb-02 16:19:02 WARNING dmalfoy attempted to log in as hpotter 2006-Feb-02 16:19:02 ERROR No such spell (spell ID 0172) 2006-Feb-02 16:19:02 CRITICAL Failed to cast Confusius
assert to check things that ought to be right| prev | Copyright © 2005-06 Python Software Foundation. | next |