diff --git a/artiq/frontend/novatech409b_controller.py b/artiq/frontend/novatech409b_controller.py index d3c5ddf75..57846ae95 100755 --- a/artiq/frontend/novatech409b_controller.py +++ b/artiq/frontend/novatech409b_controller.py @@ -4,6 +4,7 @@ import argparse import logging +import sys from artiq.devices.novatech409b.driver import Novatech409B from artiq.protocols.pc_rpc import simple_server_loop @@ -22,7 +23,7 @@ def get_argparser(): help="serial port.") parser.add_argument( "--simulation", action="store_true", - help="Put the driver in simulation mode.") + help="Put the driver in simulation mode, even if --device is used.") verbosity_args(parser) return parser @@ -32,9 +33,9 @@ def main(): init_logger(args) if not args.simulation and args.device is None: - raise ValueError("You need to specify either --simulation or " - "-d/--device argument. Use --help for more " - "information.") + print("You need to specify either --simulation or -d/--device " + "argument. Use --help for more information.") + sys.exit(1) dev = Novatech409B(args.device if not args.simulation else None) try: diff --git a/artiq/frontend/pdq2_controller.py b/artiq/frontend/pdq2_controller.py index 95b86caa5..577cdce2b 100755 --- a/artiq/frontend/pdq2_controller.py +++ b/artiq/frontend/pdq2_controller.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import argparse +import sys from artiq.devices.pdq2.driver import Pdq2 from artiq.protocols.pc_rpc import simple_server_loop @@ -15,7 +16,7 @@ def get_argparser(): help="serial port.") parser.add_argument( "--simulation", action="store_true", - help="Put the driver in simulation mode.") + help="Put the driver in simulation mode, even if --device is used.") parser.add_argument( "--dump", default="pdq2_dump.bin", help="file to dump pdq2 data into, for later simulation") @@ -29,9 +30,9 @@ def main(): port = None if not args.simulation and args.device is None: - raise ValueError("You need to specify either --simulation or " - "-d/--device argument. Use --help for more " - "information.") + print("You need to specify either --simulation or -d/--device " + "argument. Use --help for more information.") + sys.exit(1) if args.simulation: port = open(args.dump, "wb") diff --git a/artiq/frontend/pxi6733_controller.py b/artiq/frontend/pxi6733_controller.py index 1307bede2..9658dc6bb 100755 --- a/artiq/frontend/pxi6733_controller.py +++ b/artiq/frontend/pxi6733_controller.py @@ -2,6 +2,7 @@ # Yann Sionneau , 2015 import argparse +import sys from artiq.protocols.pc_rpc import simple_server_loop from artiq.devices.pxi6733.driver import DAQmx, DAQmxSim @@ -16,7 +17,8 @@ def get_argparser(): parser.add_argument("-c", "--clock", default="PFI5", help="Input clock pin name (default: PFI5)") parser.add_argument("--simulation", action='store_true', - help="Put the driver in simulation mode.") + help="Put the driver in simulation mode, even if " + "--channels is used.") verbosity_args(parser) return parser @@ -26,9 +28,9 @@ def main(): init_logger(args) if not args.simulation and args.channels is None: - raise ValueError("You need to specify either --simulation or " - "-C/--channels argument. Use --help for more " - "information.") + print("You need to specify either --simulation or -C/--channels " + "argument. Use --help for more information.") + sys.exit(1) if args.simulation: daq = DAQmxSim() diff --git a/artiq/frontend/thorlabs_tcube_controller.py b/artiq/frontend/thorlabs_tcube_controller.py index fd879d0a5..85ccc6ebc 100755 --- a/artiq/frontend/thorlabs_tcube_controller.py +++ b/artiq/frontend/thorlabs_tcube_controller.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import argparse +import sys from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim from artiq.protocols.pc_rpc import simple_server_loop @@ -16,7 +17,8 @@ def get_argparser(): help="serial device. See documentation for how to " "specify a USB Serial Number.") parser.add_argument("--simulation", action="store_true", - help="Put the driver in simulation mode.") + help="Put the driver in simulation mode, even if " + "--device is used.") simple_network_args(parser, 3255) verbosity_args(parser) return parser @@ -27,9 +29,9 @@ def main(): init_logger(args) if not args.simulation and args.device is None: - raise ValueError("You need to specify either --simulation or " - "-d/--device argument. Use --help for more " - "information.") + print("You need to specify either --simulation or -d/--device " + "argument. Use --help for more information.") + sys.exit(1) if args.simulation: if args.product == "TDC001":