visualstudio_py_debugger.py 文件源码

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

项目:AutoDiff 作者: icewall 项目源码 文件源码
def print_exception():
    # count the debugger frames to be removed
    tb = traceback.extract_tb(sys.exc_info()[2])
    debugger_count = len(tb)
    while debugger_count:
        if is_same_py_file(tb[debugger_count - 1][0], __file__):
            break
        debugger_count -= 1

    # print the traceback
    tb = tb[debugger_count:]
    if tb:
        print('Traceback (most recent call last):')
        for out in traceback.format_list(tb):
            sys.stdout.write(out)

    # print the exception
    for out in traceback.format_exception_only(sys.exc_info()[0], sys.exc_info()[1]):
        sys.stdout.write(out)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号