arsenal.debug
¶
Module Contents¶
-
arsenal.debug.
extract
(source=None)[source]¶ Copies the variables of the caller up to iPython. Useful for debugging.
In a Jupyter notebook, create a cell after an exception has occurred with
%%debug from arsenal.debug import extract; extract()
- Parameters
source – A method or module from which to extract local variables. If not specified the current scope’s locals will be used.
Notes
Taken from Andy Jones’ personal library https://github.com/andyljones/aljpy/blob/master/aljpy/debugging.py All rights go to him.
See also
Andy wrote a blog post explaining how he uses this code: https://andyljones.com/posts/post-mortem-plotting.html
def f(): x = 'hello world' extract() f() # raises an error print(x) # prints 'hello world'