diff --git a/stcgal/frontend.py b/stcgal/frontend.py index f3ac224..d3ef877 100644 --- a/stcgal/frontend.py +++ b/stcgal/frontend.py @@ -139,11 +139,6 @@ class StcGal: else: self.protocol.disconnect() return 0 - except IOError as e: - sys.stdout.flush(); - print("I/O error: %s" % e, file=sys.stderr) - self.protocol.disconnect() - return 1 except NameError as e: sys.stdout.flush(); print("Option error: %s" % e, file=sys.stderr) @@ -162,6 +157,11 @@ class StcGal: except serial.SerialException as e: print("Serial port error: %s" % e, file=sys.stderr) return 1 + except IOError as e: + sys.stdout.flush(); + print("I/O error: %s" % e, file=sys.stderr) + self.protocol.disconnect() + return 1 def cli():