From bfc996aafb95832a816c2342df5029d099eee2ad Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sun, 15 Sep 2019 16:21:58 +0200 Subject: convert some string into bytes --- common/hostchooser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/hostchooser.py b/common/hostchooser.py index 7dea833..bbb0eb6 100644 --- a/common/hostchooser.py +++ b/common/hostchooser.py @@ -32,7 +32,7 @@ def answer_ping(s, descr, addr, extra='', httpport=''): print("ping by", source, file=sys.stderr) answer = '%s:%s:%s:%s:%s:%s' % (PONG_MESSAGE, descr, addr[0], addr[1], extra, httpport) - s.sendto(answer, source) + s.sendto(answer.encode(), source) else: print("unexpected data on UDP port %d by" % UDP_PORT, source, file=sys.stderr) @@ -116,7 +116,7 @@ def find_servers(hostlist=[('127.0.0.1', None), ('', None)], else: hostsend, hostrecv = events.setdefault(ipaddr, ([], [])) hostrecv.append(time.time()) - data = data.split(':') + data = data.split(b':') if len(data) >= 4 and data[0] == PONG_MESSAGE: try: port = int(data[3]) -- cgit v1.2.3