debug.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:e2end 作者: oplatek 项目源码 文件源码
def exc_info_hook(exc_type, value, tb):
    """An exception hook that starts IPdb automatically on error if in interactive mode."""

    if hasattr(sys, 'ps1') or not sys.stderr.isatty() or exc_type == KeyboardInterrupt:
        # we are in interactive mode, we don't have a tty-like
        # device,, or the user triggered a KeyboardInterrupt,
        # so we call the default hook
        sys.__excepthook__(exc_type, value, tb)
    else:
        import traceback
        import ipdb
        # we are NOT in interactive mode, print the exception
        traceback.print_exception(exc_type, value, tb)
        # then start the debugger in post-mortem mode.
        # pdb.pm() # deprecated
        ipdb.post_mortem(tb)  # more modern
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号