Ejemplo n.º 1
0
        elif opt in ('-s', '--server'):
            server = str(arg)
            print("Connecting to Redis server at " + str(server))

    # Initialise a serial class, or
    try:
        comms = Comms(port, baud, timeout)
    except Exception as e:
        if wt.confirm("Can't initialise serial, exit?\n\n" + str(e)):
            sys.exit(1)
        raise (e)

    print(namebadge)

    ds = DataStore(host=server)
    m = Mapping(ds=ds)
    pf = Particles(mapper=m)

    try:
        main()
    except KeyboardInterrupt as e:
        comms.drive(0, 0)
        print("Stopping and Quitting...")
        raise e

else:
    # if *not* running as __main__
    # invoke the class with defaults
    comms = Comms()
    ds = DataStore()