import code; code.interact(local=dict(globals(), **locals())) |
Me too <3
The best thing about this snippet is how intuitive it is.
How do I continue execution when I want to exit the interpreter?
@crajcan you probably figured this out, so for those who come later, ^D seems to continue execution.
I wonder if maybe this should be saved somewhere besides a gist
@charterchap No. ^D continues execution, exit() terminates completely.
perfect! Its a standard in my work ;)
import ipdb; ipdb.set_trace()
danke!
Amazing! Thank you!
It was very helpful to me.
⭐ 👍
Very helpful, thank you 👍 !
still searching for this
jjajaja
i dont see how to use this...how do i view the data in my object? is it the same commands as pdb?
i dont see how to use this...how do i view the data in my object? is it the same commands as pdb?
@TimB0 The same way you would in an interactive Python shell :)
$ python3 -c 'x = 42; import code; code.interact(local=dict(globals(), **locals()))'
>>> x
42
(and when you're done, use ^D
(EOF) to continue or quit()
to abort the program)
def pry():
import inspect
frame = inspect.currentframe().f_back
try:
import code;
code.interact(local=dict(frame.f_globals, **frame.f_locals))
finally:
del frame
Just wanted to say that I love this snippet ❤️