sábado, 7 de enero de 2017

Python debugging

Install interactive debugging

sudo -H pip install ipdb

To debug a script in ipython
that uses parameters in its call:

ipython -m ipdb './xvalues.py' -- -d TUB

The parameters for the script are passed after "--"

Once you have the shell, the useful commands are:
  • n "next"
  • <ENTER> repeats the last command
  • p "print" p variable
  • s "step into"
  • b "breakpoint" b. This can be interesting: break at line 25: b 25. Break when method x of object y is called b y.x
  • r "continue to end of subroutine"
  • c "continue till the end"

Useful link
https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/

viernes, 6 de enero de 2017