summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2020-11-23 04:52:03 +0100
committerChris Liechti <cliechti@gmx.net>2020-11-23 04:52:03 +0100
commitbc88b9250e9cd93aa56ed021ff2c4405f4c3875c (patch)
tree6f7c6d0a1cb866227f05d2835d30ae9da48c9894
parent54a6b00a7ce200755e0cde0fc3f2ae0dbc2e723a (diff)
downloadpyserial-git-bc88b9250e9cd93aa56ed021ff2c4405f4c3875c.tar.gz
spy: ensure bytes in write()
-rw-r--r--serial/urlhandler/protocol_spy.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/serial/urlhandler/protocol_spy.py b/serial/urlhandler/protocol_spy.py
index 92aaa2e..67c700b 100644
--- a/serial/urlhandler/protocol_spy.py
+++ b/serial/urlhandler/protocol_spy.py
@@ -26,6 +26,7 @@ import sys
import time
import serial
+from serial.serialutil import to_bytes
try:
import urlparse
@@ -200,6 +201,7 @@ class Serial(serial.Serial):
return ''.join([parts.netloc, parts.path])
def write(self, tx):
+ tx = to_bytes(tx)
self.formatter.tx(tx)
return super(Serial, self).write(tx)