Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Debugging Python with pudb

1. Install pudb pip package..

 $ pip install pudb

2. Add the following statement in python code.
import pudb; pudb.set_trace()
3. Or, Launch the debugger like below
$ python -m pudb my_script.py

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...