Convert string to bytes in variable_server.py for Python 3

* Method socket.sendall() expects bytes to be sent, rather than a string
* Python 3 stores text strings as unicode (not ASCII) by default
* Therefore, strings must be explicitly converted to bytes for Python 3 compatibility
* This works for both Python 2 and Python 3 (tested on Python 2.7, Python 3.6, and Python 3.7)
This commit is contained in:
nmerlene 2019-04-24 15:45:06 -05:00 committed by GitHub
parent b029fae692
commit 38bfdf2a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -860,7 +860,7 @@ class VariableServer(object):
self.Channel.BOTH: [self._synchronous_socket,
self._asynchronous_socket]
}[channel]:
channel.sendall(command)
channel.sendall(command.encode())
def readline(self, synchronous_channel=True):
"""