Skip to content

player object loses action property #1

Description

@geraintwhite

For some reason the player object in client.py loses its action property.

In server.py we get a KeyError on action in the data sent by a client:

  File "server.py", line 89, in listen
    self.server.handle(self, data)
  File "server.py", line 47, in handle
    data['action']](client, data, self.clients)
KeyError: 'action'

In client.py we get this output when printing player after a keypress:

{'action': 'move', 'y': 29, 'x': 58}
{'action': 'move', 'y': 29, 'x': 59}
{'y': 1, 'x': 117}
{'y': 1, 'x': 0}
{'y': 1, 'x': 117}
{'y': 0, 'x': 117}
{'y': 0, 'x': 116}
{'y': 0, 'x': 117}
{'y': 57, 'x': 117}

Also in client.py we get this the first time running after the server is started:

{'action': 'move', 'x': 60, 'y': 29}
{'action': 'move', 'x': 61, 'y': 29}
{'x': 4, 'y': 58}
Traceback (most recent call last):
  File "client.py", line 114, in <module>
    main()
  File "client.py", line 106, in main
    out[player['y']][player['x']] = '#'
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions