Skip to content

Instantly share code, notes, and snippets.

@andrelaszlo
Created November 3, 2014 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrelaszlo/b6b0f1dfbff344fcbe66 to your computer and use it in GitHub Desktop.
Save andrelaszlo/b6b0f1dfbff344fcbe66 to your computer and use it in GitHub Desktop.
Start interactive shell inside pythons cript
def drop_shell(global_vars, local_vars):
""" Call with drop_shell(global_vars().copy(), locals()) """
import readline # optional, will allow Up/Down/History in the console
import code
global_vars.update(local_vars)
shell = code.InteractiveConsole(global_vars)
shell.interact()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment