diff --git a/lectures/debugging.md b/lectures/debugging.md index c3822a34..431e0b8c 100644 --- a/lectures/debugging.md +++ b/lectures/debugging.md @@ -121,13 +121,15 @@ plot_log() # Call the function, generate plot But this time we type in the following cell block -```ipython +```{code-block} ipython +:class: no-execute %debug ``` You should be dropped into a new prompt that looks something like this -```ipython +```{code-block} ipython +:class: no-execute ipdb> ``` @@ -138,7 +140,8 @@ Now we can investigate the value of our variables at this point in the program, For example, here we simply type the name `ax` to see what's happening with this object: -```ipython +```{code-block} ipython +:class: no-execute ipdb> ax array([, ], dtype=object) @@ -150,7 +153,8 @@ problem. To find out what else you can do from inside `ipdb` (or `pdb`), use the online help -```ipython +```{code-block} ipython +:class: no-execute ipdb> h Documented commands (type help ): @@ -203,7 +207,8 @@ To investigate, it would be helpful if we could inspect variables like `x` durin To this end, we add a "break point" by inserting `breakpoint()` inside the function code block -```python3 +```{code-block} python3 +:class: no-execute def plot_log(): breakpoint() fig, ax = plt.subplots() @@ -216,7 +221,8 @@ plot_log() Now let's run the script, and investigate via the debugger -```ipython +```{code-block} ipython +:class: no-execute > (6)plot_log() -> fig, ax = plt.subplots() (Pdb) n