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()
source – A method or module from which to extract local variables. If not specified the current scope’s locals will be used.
Taken from Andy Jones’ personal library https://github.com/andyljones/aljpy/blob/master/aljpy/debugging.py All rights go to him.
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'