def print_exc_plus(stream=sys.stdout):
    '''print normal traceback information with some local arg values'''
    # code of this mothod is mainly from <Python Cookbook>
    write = stream.write    # assert the mothod exists
    flush = stream.flush
    tp, value, tb = sys.exc_info()
    while tb.tb_next:
        tb = tb.tb_next
    stack = list()
    f = tb.tb_frame
    while f:
        stack.append(f)
        f = f.f_back
    stack.reverse()
    try:
        traceback.print_exc(None, stream)
    except BaseException as e:
        write(u("FAILED PRINTING TRACE\n\n"))
        write(u(str(value)))
        write(u('\n\n'))
    finally:
        flush()

    write(u('Locals by frame, innermost last\n'))
    for frame in stack:
        write(u('\nFrame %s in %s at line %s\n' % (frame.f_code.co_name,
                                                   frame.f_code.co_filename,
                                                   frame.f_lineno)))
    for key, value, in frame.f_locals.items():
        write(u('\t%20s = ' % key))
        try:
            write(u('%s\n' % value))
        except:
            write(u('<ERROR WHILE PRINTING VALUE>\n'))
    flush()
dataset/ETHPy150Open TylerTemp/docpie/docpie/tracemore.py/print_exc_plus/original