Fix python3 issues in serial transmission
Added basic conversion between string and bytes for sending data on the serial line.
@@ -67,7 +67,7 @@ class EnclosureReader(Thread):
try:
data = self.serial.readline()[:-2]
if data:
- self.process(data)
+ self.process(data.decode())
except Exception as e:
LOG.error("Reading error: {0}".format(e))
@@ -212,8 +212,8 @@ class EnclosureWriter(Thread):
def flush(self):
while self.alive:
try:
- cmd = self.commands.get()
- self.serial.write(cmd + '\n')
+ cmd = self.commands.get() + '\n'
+ self.serial.write(cmd.encode())
self.commands.task_done()
except Exception as e:
LOG.error("Writing error: {0}".format(e))
