diff options
author | Diego Roversi <diegor@tiscali.it> | 2019-09-20 12:28:53 +0200 |
---|---|---|
committer | Diego Roversi <diegor@tiscali.it> | 2019-09-20 12:28:53 +0200 |
commit | 47fe2095b64aef7985c6ec0182dfb22e81dea3ed (patch) | |
tree | f8eaf84a033792c61ed28c420b69193de5168f5c | |
parent | 292c8b2b06c71ef4f08b3b99a3545365261ef2d2 (diff) |
fix local import, convert string to bytearray
-rw-r--r-- | display/pclient.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/display/pclient.py b/display/pclient.py index b7ade98..9c8f9f4 100644 --- a/display/pclient.py +++ b/display/pclient.py @@ -8,9 +8,9 @@ import time from common.msgstruct import * from common.pixmap import decodepixmap from common import hostchooser -from . import modes -from .modes import KeyPressed, KeyReleased -from . import caching +import modes +from modes import KeyPressed, KeyReleased +import caching #import psyco; psyco.full() @@ -111,7 +111,7 @@ class Playfield: except error as e: print("Cannot set TCP_NODELAY:", str(e), file=sys.stderr) - initialbuf = "" + initialbuf = b"" while 1: t = self.s.recv(200) if not t and not hasattr(self.s, 'RECV_CAN_RETURN_EMPTY'): @@ -122,9 +122,9 @@ class Playfield: tail = initialbuf[len(MSG_WELCOME):] if head != MSG_WELCOME: raise error("connected to something not a game server") - if '\n' in tail: + if b'\n' in tail: break - n = tail.index('\n') + n = tail.index(b'\n') line2 = tail[:n] self.initialbuf = tail[n+1:] @@ -237,7 +237,7 @@ class Playfield: self.udpbytecounter += len(udpdata) if udpdata == BROADCAST_MESSAGE: if not self.accepted_broadcast: - self.s.sendall(message(CMSG_UDP_PORT, '*')) + self.s.sendall(message(CMSG_UDP_PORT, b'*')) self.accepted_broadcast = 1 #self.udpsock_low = None udpdata = '' @@ -515,7 +515,7 @@ class Playfield: host, port = self.udpsock.getsockname() # Send a dummy UDP message to the server. Some NATs will # then let through the UDP messages from the server. - self.udpsock.sendto('.', self.s.getpeername()) + self.udpsock.sendto(b'.', self.s.getpeername()) self.iwtd.append(self.udpsock) self.initial_iwtd.append(self.udpsock) if 'sendudpto' in PORTS: @@ -525,7 +525,7 @@ class Playfield: if self.snd and self.snd.has_music: outbound.append(message(CMSG_ENABLE_MUSIC, 1)) outbound.append(message(CMSG_PING)) - self.s.sendall(''.join(outbound)) + self.s.sendall(b''.join(outbound)) def start_udp_over_tcp(self): self.pending_udp_data = '' @@ -675,7 +675,7 @@ class Playfield: self.height = height if gameident: self.gameident = gameident - self.dpy = modes.open_dpy(self.screenmode, width, height, self.gameident) + self.dpy = modes.open_dpy(self.screenmode, width, height, self.gameident.decode()) self.snd = self.snd or modes.open_snd(self.screenmode) if self.snd: self.s.sendall(message(CMSG_ENABLE_SOUND)) |