Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IPython debugger. This is a slightly changed ipdb code.
# This is a slightly changed ipdb (http://pypi.python.org/pypi/ipdb) code.
# Shell creation was moved to the set_trace function, because the issue
# with standart unittest module. Now it is usable.
try:
import sys
from IPython.Debugger import Pdb
from IPython import ipapi
from IPython.Shell import IPShell
def set_trace():
shell = IPShell(argv=[])
ip = ipapi.get()
Pdb(ip.options.colors).set_trace(sys._getframe().f_back)
except ImportError:
from pdb import set_trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment