From d23c1b06c6e1429e34ad73139bcaef5cb3f66aeb Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 31 Oct 2021 14:15:32 -0400 Subject: [PATCH] gcode: Fix Python3 syntax error Fix error introduced in d6c3aaad. Also, go back to only accepting ascii characters on input. Signed-off-by: Kevin O'Connor --- klippy/gcode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klippy/gcode.py b/klippy/gcode.py index e1769e47..66fc623c 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -381,8 +381,8 @@ class GCodeIO: def _process_data(self, eventtime): # Read input, separate by newline, and add to pending_commands try: - data = str(os.read(self.fd, 4096).decode('utf8')) - except os.error, UnicodeDecodeError: + data = str(os.read(self.fd, 4096).decode()) + except (os.error, UnicodeDecodeError): logging.exception("Read g-code") return self.input_log.append((eventtime, data))