utils.py 文件源码

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

项目:satori-rtm-sdk-python 作者: satori-com 项目源码 文件源码
def print_all_stacktraces():
    print("\n*** STACKTRACE - START ***\n")
    code = []
    for threadId, stack in sys._current_frames().items():
        threadName = ''
        for t in threading.enumerate():
            if t.ident == threadId:
                threadName = t.name
        code.append("\n# ThreadID: %s %s" % (threadId, threadName))
        for filename, lineno, name, line in traceback.extract_stack(stack):
            code.append('File: "%s", line %d, in %s' % (filename,
                                                        lineno, name))
            if line:
                code.append("  %s" % (line.strip()))

    for line in code:
        print(line)
    print("\n*** STACKTRACE - END ***\n")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号