Traceroute/Traceroute.py
def start_trace(*fuzzy_search_list):
    """Enter the tracert command, start test and catch the exceptions.

    This function simulates tracert, an executable command on the
    Windows operating system. It will catch a wrong command before a test
    and print a warning.

    Args:
        :param fuzzy_search_list: Ignore case to find the correct command.

    Raises:
        socket.gaierror: The destination host name could not be resolved.
        ValueError: the parameter for option "-w" is wrong.
    """
    startflag = True
    while startflag:
        command = input(os.getcwd() + ">" + os.path.basename(sys.argv[0]) + ">").split()
        cmdLen = len(command)
        if cmdLen == 0:
             # Okay, pass.
             continue
        elif cmdLen == 1:
            if command[0] == "exit":
             startflag = False
            else:
             print("Command error.")
        elif cmdLen == 2:
            if command[0] in fuzzy_search_list:
                try:
                    trace_route(command[1])
                except socket.gaierror:
                    print("The destination host name " + command[1] + " could not be resolved.")
            else:
                print("Command error.")
        elif cmdLen == 4 :
            if command[0] in fuzzy_search_list:
                if command[1] == "-w":
                    try:
                        trace_route(command[3], int(command[2]))
                    except ValueError:
                        print("Bad value for option -w, ",end = "")
                        print("valid range is from 1 to 4294967295.")
                    except socket.gaierror:
                        print("The destination host name " + command[1] + " could not be resolved.")
                else:
                    print("Command error.")
            else:
                print("Command error.")
        else:
            print("Command error.")
        # Tricky tip: leave the cursor at the end.
        time.sleep(0.3)
Enter the tracert command, start test and catch the exceptions.

    This function simulates tracert, an executable command on the
    Windows operating system. It will catch a wrong command before a test
    and print a warning.

    Args:
        :param fuzzy_search_list: Ignore case to find the correct command.

    Raises:
        socket.gaierror: The destination host name could not be resolved.
        ValueError: the parameter for option "-w" is wrong.
    
Enter the tracert command, start test and catch the exceptions.
This function simulates tracert, an executable command on the
Windows operating system. It will catch a wrong command before a test
and print a warning.
Enter the tracert command start test and catch the exceptions . This function simulates tracert an executable command on the Windows operating system . It will catch a wrong command before a test and print a warning .
def start_trace(*fuzzy_search_list):
    startflag = True
    while startflag:
        command = input(os.getcwd() + ">" + os.path.basename(sys.argv[0]) + ">").split()
        cmdLen = len(command)
        if cmdLen == 0:
             continue
        elif cmdLen == 1:
            if command[0] == "exit":
             startflag = False
            else:
             print("Command error.")
        elif cmdLen == 2:
            if command[0] in fuzzy_search_list:
                try:
                    trace_route(command[1])
                except socket.gaierror:
                    print("The destination host name " + command[1] + " could not be resolved.")
            else:
                print("Command error.")
        elif cmdLen == 4 :
            if command[0] in fuzzy_search_list:
                if command[1] == "-w":
                    try:
                        trace_route(command[3], int(command[2]))
                    except ValueError:
                        print("Bad value for option -w, ",end = "")
                        print("valid range is from 1 to 4294967295.")
                    except socket.gaierror:
                        print("The destination host name " + command[1] + " could not be resolved.")
                else:
                    print("Command error.")
            else:
                print("Command error.")
        else:
            print("Command error.")
        time.sleep(0.3)
def start_trace ( * fuzzy_search_list ) : startflag = True while startflag : command = input ( os . getcwd ( ) + ">" + os . path . basename ( sys . argv [ 0 ] ) + ">" ) . split ( ) cmdLen = len ( command ) if cmdLen == 0 : continue elif cmdLen == 1 : if command [ 0 ] == "exit" : startflag = False else : print ( "Command error." ) elif cmdLen == 2 : if command [ 0 ] in fuzzy_search_list : try : trace_route ( command [ 1 ] ) except socket . gaierror : print ( "The destination host name " + command [ 1 ] + " could not be resolved." ) else : print ( "Command error." ) elif cmdLen == 4 : if command [ 0 ] in fuzzy_search_list : if command [ 1 ] == "-w" : try : trace_route ( command [ 3 ] , int ( command [ 2 ] ) ) except ValueError : print ( "Bad value for option -w, " , end = "" ) print ( "valid range is from 1 to 4294967295." ) except socket . gaierror : print ( "The destination host name " + command [ 1 ] + " could not be resolved." ) else : print ( "Command error." ) else : print ( "Command error." ) else : print ( "Command error." ) time . sleep ( 0.3 )
Enter the tracert command, start test and catch the exceptions.
Enter the tracert command start test and catch the exceptions .
"""Enter the tracert command, start test and catch the exceptions.

    This function simulates tracert, an executable command on the
    Windows operating system. It will catch a wrong command before a test
    and print a warning.

    Args:
        :param fuzzy_search_list: Ignore case to find the correct command.

    Raises:
        socket.gaierror: The destination host name could not be resolved.
        ValueError: the parameter for option "-w" is wrong.
    """ # Okay, pass. # Tricky tip: leave the cursor at the end.
The destination host name could not be resolved.
The destination host name could not be resolved .
socket.gaierror
the parameter for option "-w" is wrong.
the parameter for option " - w " is wrong .
ValueError
param fuzzy_search_list: Ignore case to find the correct command.
param fuzzy_search_list : Ignore case to find the correct command .