Hi Bob,
On 02/02/18 01:56, Bob Smith wrote:
> connection.Send({"action":"board","obstructions":self.obstructions,"points":self.points,"extrapoints":self.extrapoints})
>
> The code executes if the list of rectangle objects has 32 or more recs,
> but anything less than that and the program crashes with this error:
>
> error: uncaptured python exception, closing channel
> <__main__.ClientChannel
127.0.0.1:56743 at 0x515a250> (<class
> 'KeyError'>:b''
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\asyncore.py|read|83]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\asyncore.py|handle_read_event|423]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\asynchat.py|handle_read|171]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\podsixnet-79-py3.6.egg\PodSixNet\Channel.py|found_terminator|20]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\podsixnet-79-py3.6.egg\PodSixNet\rencode.py|loads|425]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\podsixnet-79-py3.6.egg\PodSixNet\rencode.py|f|411]
> [C:\Users\Anthony.Schmidt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\podsixnet-79-py3.6.egg\PodSixNet\rencode.py|f_fixed_list|362])
>
> What are some possible solutions for this? It seems odd to me that the
> number of rectangles in the list would change the outcome.
That does seem odd.
From what I can tell the receiving client is crashing because what is
being sent is being encoded incorrectly.
What you want to do is take a look at the `rencode` output that is being
sent across the network to determine what is different. You can do this
by patching rencode.py on the sending side to make it print out the
value before it is returned. Do this for both sets of rectangles and
examine the difference.
My hunch is that your objects may be more complex structures - the
rencoding is only designed to handle data structures composed of simple
types like dict, list, string, number.
Cheers,
Chris.
--
http://mccormick.cx/