From 6f77535673b11aedd67256c99a164ae3864a946c Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sun, 22 Nov 2015 04:27:46 +0100 Subject: [PATCH] Fix output in error cases --- stcgal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stcgal.py b/stcgal.py index 1b67ca9..eb531e6 100755 --- a/stcgal.py +++ b/stcgal.py @@ -2515,15 +2515,18 @@ class StcGal: self.protocol.disconnect() return 0 except NameError as e: + sys.stdout.flush(); print("Option error: %s" % e, file=sys.stderr) self.protocol.disconnect() return 1 except (StcFramingException, StcProtocolException) as e: + sys.stdout.flush(); print("Protocol error: %s" % e, file=sys.stderr) self.protocol.disconnect() return 1 except KeyboardInterrupt: - print("interrupted") + sys.stdout.flush(); + print("interrupted", file=sys.stderr) self.protocol.disconnect() return 2 except serial.SerialException as e: