def trace_error(function_index=2):
    """
    This will return the line number and line text of the last error
    :param function_index: int to tell what frame to look from
    :return: int, str of the line number and line text
    """
    info = function_info(function_index)
    traces = traceback.format_stack(limit=10)
    for trace in traces:
        file_, line_number, line_text = trace.split(',', 2)
        if file_ == '  File "%s"' % info['file'] and\
                        line_number != 'line %s' % info['line_number']:
            return line_number.split()[-1], line_text.strip()
    return None, None
def trace_error ( function_index = 2 ) : info = function_info ( function_index ) traces = traceback . format_stack ( limit = 10 ) for trace in traces : file_ , line_number , line_text = trace . split ( ',' , 2 ) if file_ == '  File "%s"' % info [ 'file' ] and line_number != 'line %s' % info [ 'line_number' ] : return line_number . split ( ) [ - 1 ] , line_text . strip ( ) return None , None
This will return the line number and line text of the last error
    :param function_index: int to tell what frame to look from
    :return: int, str of the line number and line text