Beispiel #1
0
def convert_name_to_number(name):
    station_dict = get_station_dict()

    ret = ""
    try:
        ret = station_dict.get(name)
    except:
        print(name + " is not existed in dict", file=sys.stderr)
        sys.exit(1)

    return ret
Beispiel #2
0
def convert_name_to_number(name):
    station_dict = get_station_dict()

    ret = ""
    try:
        ret = station_dict.get(name)
    except:
        print(name + " is not existed in dict", file=sys.stderr)
        sys.exit(1)

    return ret
Beispiel #3
0
def main():
    option = get_option()

    if option.list:
        dct = get_station_dict()
        for key in dct.keys():
            print(key)
        sys.exit(0)

    try:
        src = getsrc(option)
    except ConnectionError:
        print("Connection Error!", file=sys.stderr)
    except Exception as e:
        print(type(e), " exception had raised.", file=sys.stderr)

    left_minutes = get_next_bus_time(src)
    for minute in left_minutes:
        print(minute)
Beispiel #4
0
def main():
    option = get_option()

    if option.list:
        dct = get_station_dict()
        for key in dct.keys():
            print(key)
        sys.exit(0)

    try:
        src = getsrc(option)
    except ConnectionError:
        print("Connection Error!", file=sys.stderr)
    except Exception as e:
        print(type(e), " exception had raised.", file=sys.stderr)

    left_minutes = get_next_bus_time(src)
    for minute in left_minutes:
        print(minute)