@@ -121,13 +121,15 @@ plot_log() # Call the function, generate plot
|
121 | 121 | |
122 | 122 | But this time we type in the following cell block |
123 | 123 | |
124 | | -```ipython |
| 124 | +```{code-block} ipython |
| 125 | +:class: no-execute |
125 | 126 | %debug |
126 | 127 | ``` |
127 | 128 | |
128 | 129 | You should be dropped into a new prompt that looks something like this |
129 | 130 | |
130 | | -```ipython |
| 131 | +```{code-block} ipython |
| 132 | +:class: no-execute |
131 | 133 | ipdb> |
132 | 134 | ``` |
133 | 135 | |
@@ -138,7 +140,8 @@ Now we can investigate the value of our variables at this point in the program,
|
138 | 140 | For example, here we simply type the name `ax` to see what's happening with |
139 | 141 | this object: |
140 | 142 | |
141 | | -```ipython |
| 143 | +```{code-block} ipython |
| 144 | +:class: no-execute |
142 | 145 | ipdb> ax |
143 | 146 | array([<matplotlib.axes.AxesSubplot object at 0x290f5d0>, |
144 | 147 | <matplotlib.axes.AxesSubplot object at 0x2930810>], dtype=object) |
@@ -150,7 +153,8 @@ problem.
|
150 | 153 | To find out what else you can do from inside `ipdb` (or `pdb`), use the |
151 | 154 | online help |
152 | 155 | |
153 | | -```ipython |
| 156 | +```{code-block} ipython |
| 157 | +:class: no-execute |
154 | 158 | ipdb> h |
155 | 159 | |
156 | 160 | Documented commands (type help <topic>): |
@@ -203,7 +207,8 @@ To investigate, it would be helpful if we could inspect variables like `x` durin
|
203 | 207 | |
204 | 208 | To this end, we add a "break point" by inserting `breakpoint()` inside the function code block |
205 | 209 | |
206 | | -```python3 |
| 210 | +```{code-block} python3 |
| 211 | +:class: no-execute |
207 | 212 | def plot_log(): |
208 | 213 | breakpoint() |
209 | 214 | fig, ax = plt.subplots() |
@@ -216,7 +221,8 @@ plot_log()
|
216 | 221 | |
217 | 222 | Now let's run the script, and investigate via the debugger |
218 | 223 | |
219 | | -```ipython |
| 224 | +```{code-block} ipython |
| 225 | +:class: no-execute |
220 | 226 | > <ipython-input-6-a188074383b7>(6)plot_log() |
221 | 227 | -> fig, ax = plt.subplots() |
222 | 228 | (Pdb) n |
|