From cfae9f9fd82720099960910c64de6eb841e6e3ee Mon Sep 17 00:00:00 2001 From: iperov Date: Fri, 5 Apr 2019 21:50:46 +0400 Subject: [PATCH] trainer: fix for ctrl-c in --no-preview mode --- mainscripts/Trainer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mainscripts/Trainer.py b/mainscripts/Trainer.py index 25eff5b..f70b641 100644 --- a/mainscripts/Trainer.py +++ b/mainscripts/Trainer.py @@ -185,7 +185,10 @@ def main(args, device_args): op = input.get('op','') if op == 'close': break - io.process_messages(0.1) + try: + io.process_messages(0.1) + except KeyboardInterrupt: + s2c.put ( {'op': 'close'} ) else: wnd_name = "Training preview" io.named_window(wnd_name)