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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-10-31 14:15:32 -04:00
parent dd98884bb4
commit d23c1b06c6
1 changed files with 2 additions and 2 deletions

View File

@ -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))