From 644a410c90799f767b9c208c7aae5df90702e272 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 3 Nov 2015 17:54:27 +0800 Subject: [PATCH] thorlabs_tcube: fix -P case handling --- artiq/frontend/thorlabs_tcube_controller.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/artiq/frontend/thorlabs_tcube_controller.py b/artiq/frontend/thorlabs_tcube_controller.py index c9b209070..6e8d9bbc8 100755 --- a/artiq/frontend/thorlabs_tcube_controller.py +++ b/artiq/frontend/thorlabs_tcube_controller.py @@ -11,8 +11,8 @@ from artiq.tools import verbosity_args, simple_network_args, init_logger def get_argparser(): parser = argparse.ArgumentParser() parser.add_argument("-P", "--product", required=True, - help="type of the Thorlabs T-Cube device to control", - choices=["tdc001", "tpz001"]) + help="type of the Thorlabs T-Cube device to control: " + "tdc001/tpz001") parser.add_argument("-d", "--device", default=None, help="serial device. See documentation for how to " "specify a USB Serial Number.") @@ -39,11 +39,19 @@ def main(): dev = TdcSim() elif product == "tpz001": dev = TpzSim() + else: + print("Invalid product string (-P/--product), " + "choose from tdc001 or tpz001") + sys.exit(1) else: if product == "tdc001": dev = Tdc(args.device) elif product == "tpz001": dev = Tpz(args.device) + else: + print("Invalid product string (-P/--product), " + "choose from tdc001 or tpz001") + sys.exit(1) try: simple_server_loop({product: dev}, args.bind, args.port)