aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/parsedump.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-12-07 14:31:03 -0500
committerKevin O'Connor <kevin@koconnor.net>2022-12-07 14:31:03 -0500
commit336cc92a0a06a78358d1c17c7c620655a6eaa055 (patch)
tree2a32675ecd435da9ad57e44e26196ad4b060e4fd /klippy/parsedump.py
parenta42f615881a31c487067153aa7ce385146a5807c (diff)
downloadkutter-336cc92a0a06a78358d1c17c7c620655a6eaa055.tar.gz
kutter-336cc92a0a06a78358d1c17c7c620655a6eaa055.tar.xz
kutter-336cc92a0a06a78358d1c17c7c620655a6eaa055.zip
parsedump: Support running on both python2 and python3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/parsedump.py')
-rwxr-xr-xklippy/parsedump.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/parsedump.py b/klippy/parsedump.py
index 380446eb..6d419183 100755
--- a/klippy/parsedump.py
+++ b/klippy/parsedump.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
# Script to parse a serial port data dump
#
# Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net>
@@ -23,12 +23,12 @@ def main():
f = open(data_filename, 'rb')
fd = f.fileno()
- data = ""
+ data = bytearray()
while 1:
newdata = os.read(fd, 4096)
if not newdata:
break
- data += newdata
+ data += bytearray(newdata)
while 1:
l = mp.check_packet(data)
if l == 0:
@@ -37,7 +37,7 @@ def main():
logging.error("Invalid data")
data = data[-l:]
continue
- msgs = mp.dump(bytearray(data[:l]))
+ msgs = mp.dump(data[:l])
sys.stdout.write('\n'.join(msgs[1:]) + '\n')
data = data[l:]