Tutorial by Examples

The Python Standard Library includes an interactive debugging library called pdb. pdb has extensive capabilities, the most commonly used being the ability to 'step-through' a program. To immediately enter into step-through debugging use: python -m pdb <my_file.py> This will start the debu...
If IPython (or Jupyter) are installed, the debugger can be invoked using: import ipdb ipdb.set_trace() When reached, the code will exit and print: /home/usr/ook.py(3)<module>() 1 import ipdb 2 ipdb.set_trace() ----> 3 print("Hello world!") ipdb> Clea...
Some times you need to debug python code which is executed by another process and and in this cases rpdb comes in handy. rpdb is a wrapper around pdb that re-routes stdin and stdout to a socket handler. By default it opens the debugger on port 4444 Usage: # In the Python file you want to debu...

Page 1 of 1