Add Python debugging section

This commit is contained in:
Gerard Vermeulen 2024-06-01 12:49:53 +02:00
parent 410884952e
commit 034b9d68ee
2 changed files with 23 additions and 0 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@
/var
# File names:
buggy.py
column-view-demonstration.org
custom.el
dir-locals.el

View File

@ -6141,6 +6141,28 @@ configures =code-cells=.
(keymap-set map "C-c C-c" #'code-cells-eval))))
#+end_src
*** [[https://stackoverflow.com/questions/2324758/debugging-python-programs-in-emacs][Debugging Python programs in Emacs]]
:PROPERTIES:
:CUSTOM_ID: sec:debug-python
:END:
Listing [[lst:pdb-example]] shows how to start using PDB. Links of interest are:
- [[https://realpython.com/python-debugging-pdb/][Python Debugging with PDB]]
- [[https://docs.python.org/3/library/pdb.html][The Python Debugger]]
- [[yt:vfPtGsSJldg][Introduction to PDB (Python-2.7 YouTube video)]]
#+caption[PDB example: =python -m pdb .emacs.d/buggy.py=]:
#+caption: PDB example: =python -m pdb .emacs.d/buggy.py=.
#+name: lst:pdb-example
#+begin_src python -i -n :results silent :tangle buggy.py
def unsafe(x, y):
"""Raises an exception if the second argument equals zero."""
return x / y
if __name__ == "__main__":
unsafe(1.0, 0.0)
#+end_src
* [[https://github.com/emacs-tw/awesome-emacs#library][Libraries]]
:PROPERTIES:
:CUSTOM_ID: sec:libraries