本文整理汇总了Python中pdb.pm方法的典型用法代码示例。如果您正苦于以下问题:Python pdb.pm方法的具体用法?Python pdb.pm怎么用?Python pdb.pm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdb
的用法示例。
在下文中一共展示了pdb.pm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cli
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def cli(verbose, debug):
"""
Type -h or --help after any subcommand for more information.
"""
if verbose:
pass
# logger.setLevel(logging.DEBUG)
if debug:
import traceback
try:
import ipdb as pdb
except ImportError:
import pdb
def _excepthook(exc_type, value, tb):
traceback.print_exception(exc_type, value, tb)
print()
pdb.pm()
sys.excepthook = _excepthook
示例2: start
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def start():
def info(type, value, tb):
if hasattr(sys, "ps1") or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(type, value, tb)
else:
import traceback
import pdb
# we are NOT in interactive mode, print the exception...
traceback.print_exception(type, value, tb)
print
# ...then start the debugger in post-mortem mode.
# pdb.pm() # deprecated
pdb.post_mortem(tb) # more "modern"
sys.excepthook = info
示例3: debug_hook
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_hook(type_, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
sys.__excepthook__(type_, value, tb)
else:
import traceback
import pdb
traceback.print_exception(type_, value, tb)
print(u"\n")
pdb.pm()
示例4: debug
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug(type_, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
sys.__excepthook__(type_, value, tb)
else:
import traceback
import pdb
traceback.print_exception(type_, value, tb)
print(u"\n")
pdb.pm()
示例5: intercept
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def intercept (type, value, trace):
interactive = os.environ.get('PDB',None)
if interactive in ['0','']:
# PDB was set to 0 or '' which is undocumented, and we do nothing
pass
else:
bug_report(type, value, trace)
if interactive == 'true':
import pdb
pdb.pm()
示例6: debug_on_error
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
"""Code due to Thomas Heller - published in Python Cookbook (O'Reilley)"""
traceback.print_exc(type, value, tb)
print()
pdb.pm() # jdh uncomment
示例7: debug_on_error
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
"""Code due to Thomas Heller - published in Python Cookbook (O'Reilly)"""
import pdb
import traceback
traceback.print_exception(type, value, tb)
print()
pdb.pm()
示例8: debug_on_error
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
"""Code due to Thomas Heller - published in Python Cookbook (O'Reilley)"""
traceback.print_exception(type, value, tb)
print()
pdb.pm() # jdh uncomment
示例9: pm
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def pm():
post_mortem(sys.last_traceback)
# Main program for testing
示例10: on_message
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def on_message(self, message):
try:
message = json.loads(message)
f = getattr(self, 'on_message_%s' % message['type'], None)
if f is None:
raise TypeError('Invalid message type: %r' % message)
self.application.ioloop.add_callback(f, message['value'])
except:
traceback.print_exc()
pdb.pm()
示例11: cli
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def cli(post_mortem, output_profile):
'''Flexible tools for Hi-C data processing.
All pairtools have a few common options, which should be typed _before_
the command name.
'''
if post_mortem:
import traceback
try:
import ipdb as pdb
except ImportError:
import pdb
def _excepthook(exc_type, value, tb):
traceback.print_exception(exc_type, value, tb)
print()
pdb.pm()
sys.excepthook = _excepthook
if output_profile:
import cProfile
import atexit
pr = cProfile.Profile()
pr.enable()
def _atexit_profile_hook():
pr.disable()
pr.dump_stats(output_profile)
atexit.register(_atexit_profile_hook)
示例12: ExceptionHookPDB
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def ExceptionHookPDB(exctype, value, tb):
'''
A custom exception handler, with :py:obj:`pdb` post-mortem for debugging.
'''
for line in traceback.format_exception_only(exctype, value):
log.error(line.replace('\n', ''))
for line in traceback.format_tb(tb):
log.error(line.replace('\n', ''))
sys.__excepthook__(exctype, value, tb)
pdb.pm()
示例13: _DebugHandler
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def _DebugHandler(exc_class, value, tb):
if not flags.FLAGS.pdb or hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we aren't in interactive mode or we don't have a tty-like
# device, so we call the default hook
old_excepthook(exc_class, value, tb)
else:
# Don't impose import overhead on apps that never raise an exception.
import traceback
import pdb
# we are in interactive mode, print the exception...
traceback.print_exception(exc_class, value, tb)
sys.stdout.write('\n')
# ...then start the debugger in post-mortem mode.
pdb.pm()
示例14: info
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def info(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(type, value, tb)
else:
import traceback, pdb
# we are NOT in interactive mode, print the exceptionceback.print_exception(type, value, tb)
print
#tart the debugger in post-mortem mode.
# pdb.pm() # deprecated
pdb.post_mortem(tb) # more "modern"
示例15: debug
# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug(type_, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(type_, value, tb)
else:
import traceback
import pdb
# we are NOT in interactive mode, print the exception...
traceback.print_exception(type_, value, tb)
print("\n")
# ...then start the debugger in post-mortem mode.
pdb.pm()