On 09/02/07, Toon Pieton <[EMAIL PROTECTED]> 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.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to