Merge pull request #14 from vitrig/develop

Fixed issues with str vs bytes mismatch for python 3.4
This commit is contained in:
2015-08-04 14:13:20 +01:00

View File

@@ -128,15 +128,15 @@ class TS3Proto():
with self.io_lock: with self.io_lock:
self._telnet.write(commandstr.encode('utf-8') + b"\n\r") self._telnet.write(commandstr.encode('utf-8') + b"\n\r")
data = '' data = b''
response = self._telnet.read_until(b"\n\r", self._timeout) response = self._telnet.read_until(b"\n\r", self._timeout)
if not response.startswith("error"): if not response.startswith(b"error"):
# what we just got was extra data # what we just got was extra data
data = response data = response
response = self._telnet.read_until(b"\n\r", self._timeout) response = self._telnet.read_until(b"\n\r", self._timeout)
return TS3Response(response, data) return TS3Response(response.decode('utf-8'), data.decode('utf-8'))
def check_connection(self): def check_connection(self):
if not self.is_connected: if not self.is_connected:
@@ -199,7 +199,6 @@ class TS3Proto():
@param data: data string @param data: data string
@type data: string @type data: string
""" """
data = data.strip() data = data.strip()
multipart = data.split('|') multipart = data.split('|')