diff --git a/gym_donkeycar/core/client.py b/gym_donkeycar/core/client.py index 43e8d2ffb..da08ae91b 100755 --- a/gym_donkeycar/core/client.py +++ b/gym_donkeycar/core/client.py @@ -134,6 +134,13 @@ def proc_msg(self, sock): if partial[0][0] == "{": assembled_packet = "".join(partial) assembled_packet = replace_float_notation(assembled_packet) + second_open = assembled_packet.find('{"msg', 1) + if second_open != -1: + # hmm what to do? We have a partial packet. Trimming just + # the good part and discarding the rest. + logger.warn("got partial packet:" + assembled_packet[:20]) + assembled_packet = assembled_packet[second_open:] + try: j = json.loads(assembled_packet) self.on_msg_recv(j)