mirror of https://github.com/Desuuuu/klipper.git
gcode: Convert to Python3 string encoding
The error checking is not complete in this change - the code should handle the case where an input string is not valid utf8. The code will continue to run on Python2 after this change, however the execution time on Python2 is measurably slower after making this change. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1717263b5a
commit
adeb869f56
|
@ -387,7 +387,7 @@ class GCodeIO:
|
|||
return
|
||||
self.input_log.append((eventtime, data))
|
||||
self.bytes_read += len(data)
|
||||
lines = data.split('\n')
|
||||
lines = data.decode().split('\n')
|
||||
lines[0] = self.partial_input + lines[0]
|
||||
self.partial_input = lines.pop()
|
||||
pending_commands = self.pending_commands
|
||||
|
@ -427,7 +427,7 @@ class GCodeIO:
|
|||
def _respond_raw(self, msg):
|
||||
if self.pipe_is_active:
|
||||
try:
|
||||
os.write(self.fd, msg+"\n")
|
||||
os.write(self.fd, (msg+"\n").encode())
|
||||
except os.error:
|
||||
logging.exception("Write g-code response")
|
||||
self.pipe_is_active = False
|
||||
|
|
Loading…
Reference in New Issue