diff --git a/printrun/printcore.py b/printrun/printcore.py index beb9102d3..a8c89065c 100644 --- a/printrun/printcore.py +++ b/printrun/printcore.py @@ -669,12 +669,16 @@ def _send(self, command, lineno = 0, calcchecksum = False): try: self.sendcb(command, gline) except: self.logError(traceback.format_exc()) try: - self.printer.write((command + "\n").encode('ascii')) + message = (command + "\n") if self.printer_tcp: + self.printer.write(message) try: self.printer.flush() except socket.timeout: pass + else: + # serial operates on bytes, needs no flushing + self.printer.write(message.encode('ascii')) self.writefailures = 0 except socket.error as e: if e.errno is None: