[Tutor] Debugging
John Fouhy
john at fouhy.net
Fri Feb 9 00:08:30 CET 2007
On 09/02/07, Toon Pieton <pytutmail at gmail.com> wrote:
> Hey friendly users!
>
> I have a question considering debugging: is it possible to get the current
> code line that is being executed?
Are you using pdb [the python debugger]?
If you have a script 'myscript.py', you can start the script like this:
python -m pdb myscript.py
You can then set breakpoints and step through the code line-by-line using pdb.
(brief summary:
'break module:line' -- set breakpoint, eg: 'break mymodule:23'
'r' -- run program
'n' -- move to next line
's' -- move to next line, or step into function call
'c' -- continue running until next breakpoint
'p' -- print; used to inspect variables, etc.
)
Note that pdb has difficulties with multithreaded programs.
--
John.
More information about the Tutor
mailing list