Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def debug_on_assertion(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty() or type != AssertionError:
sys.__excepthook__(type, value, tb)
else:
import traceback, ipdb
traceback.print_exception(type, value, tb)
print()
ipdb.pm()
def info(type, value, tb):
ipdb.pm()
def _excepthook(exc_type, value, tb):
traceback.print_exception(exc_type, value, tb)
print()
ipdb.pm()
def _excepthook(exc_type, value, tb):
traceback.print_exception(exc_type, value, tb)
print()
pdb.pm()
sys.excepthook = _excepthook
print(say(tracetext))
print(say('[ERROR]', 'red_black') + ' ' +
say('%s' % exc_obj, 'cyan_black'))
else:
try:
import ipdb as pdb_this
except ImportError:
print(
'note',
'entering debug mode but cannot find ipdb so we are using pdb')
import pdb as pdb_this
print(say(tracetext))
print(say('[ERROR]', 'red_black') + ' ' +
say('%s' % exc_obj, 'cyan_black'))
print(say('[DEBUG] entering the debugger', 'mag_gray'))
pdb_this.pm()
def info(etype, value, tb):
traceback.print_exception(etype, value, tb)
pdb.pm()
def info(type, value, tb):
ipdb.pm()
def info(type, value, tb):
ipdb.pm()
def info(type, value, tb):
ipdb.pm()