Debugging Tips and Tricks

  • Python basic and Application
  • 2016-08-14 (Sun) 16:05 - 16:30
  • English
  • 103
  • Photography and recording is allowed

Slide

https://slides.com/invisibleroads/debugging-tips

Video

https://youtu.be/xDz8WVO_wjE

PDF

https://github.com/pythonkr/pyconapac-2016-files/raw/master/20160814-103-41-RoyHyunjinHan.pdf

Description

Debugging Tips and Tricks

Presentation slides

https://slides.com/invisibleroads/debugging-tips


Demonstration video

https://youtu.be/yZ3Ypil6sJk


Extended notes

https://github.com/crosscompute/crosscompute-tutorials/tree/master/debugging-tips#python-debugging-tips-and-tricks 


1. Examine exception while running interpreter

jupyter notebook
    debug

2. Pinpoint variables in scope

import IPython; IPython.embed()
    whos

 3. Step through execution at breakpoint

import pudb; pudb.set_trace()

4. Drop into debugger without modifying code

pudb -- xyz.py arg1 arg2 

5. Trace on CTRL-C

import pudb; pudb.set_interrupt_handler()

6. Debug threads or Docker containers

import wdb; wdb.set_trace()

7. Use namespaced logger with rsyslog server

logging.getLogger(__name__)

8. Debug tests

pip install pdbpp; py.test --pdb

Comments

blog comments powered by Disqus

Sponsors

Keystone

Diamond

Platinum

Gold

Startup

Silver

Media