Can you step through python code to help debug issues? -


in java/c# can step through code trace might going wrong, , ide's make process user friendly.

can trace through python code in similiar fashion?

yes! there's python debugger called pdb doing that!

you can launch python program through pdb using pdb myscript.py or python -m pdb myscript.py.

there few commands can issue, documented on pdb page.

some useful ones remember are:

  • b: set breakpoint
  • c: continue debugging until hit breakpoint
  • s: step through code
  • n: go next line of code
  • l: list source code current file (default: 11 lines including line being executed)
  • u: navigate stack frame
  • d: navigate down stack frame
  • p: print value of expression in current context

if don't want use command line debugger, ides pydev have gui debugger.


Comments

Popular posts from this blog

php - Using str_replace to translate a MySQL Table in html -

SQL Server - MyCTE query based on 24 hour period (next day) -

asp.net mvc - Cannot display error message on Editor or EditorFor -