Last active
August 29, 2015 14:09
-
-
Save karolyi/20fa77042dfa66023929 to your computer and use it in GitHub Desktop.
Open interactive shell to investigate when something throws an exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
# this is what fails here | |
context['children'] = mark_safe(u''.join(parts)) | |
except: | |
import code | |
import readline | |
import rlcompleter | |
vars = globals() | |
vars.update(locals()) | |
readline.set_completer(rlcompleter.Completer(vars).complete) | |
readline.parse_and_bind("tab: complete") | |
shell = code.InteractiveConsole(vars) | |
shell.interact() | |
# OR, w/ IPython: | |
from IPython import embed | |
embed() # this call anywhere in your program will start IPython |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment