set asyncio loop earlier in controllers (#627)

This commit is contained in:
Sebastien Bourdeauducq 2016-12-12 11:38:02 +08:00
parent 3743633b04
commit cbc49ea91d
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@
import argparse import argparse
import logging import logging
import sys import sys
import os
import asyncio import asyncio
from artiq.devices.novatech409b.driver import Novatech409B from artiq.devices.novatech409b.driver import Novatech409B
@ -33,6 +34,9 @@ def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
init_logger(args) init_logger(args)
if os.name == "nt":
asyncio.set_event_loop(asyncio.ProactorEventLoop())
if not args.simulation and args.device is None: if not args.simulation and args.device is None:
print("You need to specify either --simulation or -d/--device " print("You need to specify either --simulation or -d/--device "
"argument. Use --help for more information.") "argument. Use --help for more information.")

View File

@ -2,6 +2,8 @@
import argparse import argparse
import sys import sys
import os
import asyncio
from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim
from artiq.protocols.pc_rpc import simple_server_loop from artiq.protocols.pc_rpc import simple_server_loop
@ -28,6 +30,9 @@ def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
init_logger(args) init_logger(args)
if os.name == "nt":
asyncio.set_event_loop(asyncio.ProactorEventLoop())
if not args.simulation and args.device is None: if not args.simulation and args.device is None:
print("You need to specify either --simulation or -d/--device " print("You need to specify either --simulation or -d/--device "
"argument. Use --help for more information.") "argument. Use --help for more information.")