From cbc49ea91d82c6d78a4c361a9e402cadb39bb3e1 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 12 Dec 2016 11:38:02 +0800 Subject: [PATCH] set asyncio loop earlier in controllers (#627) --- artiq/frontend/novatech409b_controller.py | 4 ++++ artiq/frontend/thorlabs_tcube_controller.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/artiq/frontend/novatech409b_controller.py b/artiq/frontend/novatech409b_controller.py index bf4f32be4..38e2f5f97 100755 --- a/artiq/frontend/novatech409b_controller.py +++ b/artiq/frontend/novatech409b_controller.py @@ -5,6 +5,7 @@ import argparse import logging import sys +import os import asyncio from artiq.devices.novatech409b.driver import Novatech409B @@ -33,6 +34,9 @@ def main(): args = get_argparser().parse_args() init_logger(args) + if os.name == "nt": + asyncio.set_event_loop(asyncio.ProactorEventLoop()) + if not args.simulation and args.device is None: print("You need to specify either --simulation or -d/--device " "argument. Use --help for more information.") diff --git a/artiq/frontend/thorlabs_tcube_controller.py b/artiq/frontend/thorlabs_tcube_controller.py index 6323e1f76..4c8fb57ed 100755 --- a/artiq/frontend/thorlabs_tcube_controller.py +++ b/artiq/frontend/thorlabs_tcube_controller.py @@ -2,6 +2,8 @@ import argparse import sys +import os +import asyncio from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim from artiq.protocols.pc_rpc import simple_server_loop @@ -28,6 +30,9 @@ def main(): args = get_argparser().parse_args() init_logger(args) + if os.name == "nt": + asyncio.set_event_loop(asyncio.ProactorEventLoop()) + if not args.simulation and args.device is None: print("You need to specify either --simulation or -d/--device " "argument. Use --help for more information.")