Python programming | Debugging
Python programming -- Debugging
Finn ?Arup Nielsen
DTU Compute Technical University of Denmark
October 30, 2013
Python debugging
Overview
print, pprint logging pdb: The Python Debugger Spyder PuDB Introspection with Paul Butler's debugging decorator
Finn ?Arup Nielsen
1
October 30, 2013
Python debugging
Before major debugging
Write unit tests: Consider test-driven development where you first write the test code and then implement the functionality. Run pylint: This will check you code for style and perhaps discover "real" bugs
Finn ?Arup Nielsen
2
October 30, 2013
Python debugging
Print
print: While ok in development print statements should usually not occure in the finished code whether executed or not (comment out).
For nested structures, such as dictionaries within lists within dictionaries consider pprint (note the extra "p")
import pprint, requests response = requests.get("").json() pprint.pprint(response["items"][0]) This gives you a better indentation of the nested structure.
Finn ?Arup Nielsen
3
October 30, 2013
Python debugging
logging module
Set different level of logging messages: DEBUG, INFO, WARNING, ERROR Useful for, e.g., for a web application that never should error, but always return something useful. Consistent formatting with timing information Setting of the logging level Redirection of the logging output: standard error, log files.
Finn ?Arup Nielsen
4
October 30, 2013
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- file management search and replace keyboard shortcuts for
- how to debug your python program
- final europython get productive with python and vs code
- debugging in python
- python programming debugging
- tools in action visual studio code
- setup python and visual studio code windows machines
- debugging rust with visual studio code github pages
- using visual studio and vs code for embedded c c
Related searches
- python programming books free pdf
- best python programming book
- python programming language pdf book
- free python programming books
- python programming pdf free download
- python programming tutorials
- python programming for absolute beginners
- python programming on win32 download
- basic python programming examples
- python programming examples pdf
- python programming examples source code
- introduction to python programming pdf