Debugger Confusion

Robert Brewer fumanchu at amor.org
Tue Jun 28 23:02:35 CEST 2005


Rex Eastbourne wrote:
> I'm a little confused about which debugging utilities do what, and
> which I should use for my Python code. I'd like to be able to step
> through my code, insert breakpoints, etc. I haven't been able to do
> this yet (I'm using Emacs on Windows). I have seen references to GDB,
> GUD, PDB, and others. Which ones do I need?

1. At the point you would like to start the debugger, insert the
following 2 lines:

    import pdb
    pdb.set_trace()

2. Run your script from the command line.
3. When your script executes the above lines, the pdb debugger will
start up, and give you a prompt. Type 'h' at the prompt (and hit
'enter'), and you'll be shown a list of pdb commands. 's' to step
through your code, 'c' to continue processing (and stop the debugger,
essentially). The prompt is interactive, so you can inspect program
variables as you like.

Start with that, and come back if you have any more questions. :)


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list