chillavanilla / TeeworldsEconMod

A python script which communicates with teeworlds server log as input and econ connection as output.
MIT License
3 stars 2 forks source link

Crash on start: Broken pipe #53

Closed ChillerDragon closed 3 years ago

ChillerDragon commented 3 years ago
[07:28:55][chat]: *** [TEM] starting...
Traceback (most recent call last):
  File "./src/main.py", line 109, in <module>
    main(sys.argv[1:])
  File "./src/main.py", line 105, in main
    main_loop(_router)
  File "./src/main.py", line 35, in main_loop
    _router.handle_data(line[1:20], line[21:])  # cut off the timestamp
  File "/home/chiller/git/TeeworldsEconMod/src/router.py", line 69, in handle_data
    self.players_controller.handle_player_team(data[:-1])  # chop of newline
  File "/home/chiller/git/TeeworldsEconMod/src/controllers/players.py", line 250, in handle_player_team
    self.create_player(name, player.cid, player.ip_addr, player.team)
  File "/home/chiller/git/TeeworldsEconMod/src/controllers/players.py", line 29, in create_player
    player = self.init_player(name, cid, ip_addr, team, show_stats, spree)
  File "/home/chiller/git/TeeworldsEconMod/src/controllers/players.py", line 42, in init_player
    load_player.show_stats()
  File "/home/chiller/git/TeeworldsEconMod/src/models/player.py", line 185, in show_stats
    str(self.best_spree))
  File "/home/chiller/git/TeeworldsEconMod/src/base/rcon.py", line 22, in say
    sys.stdout.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
ChillerDragon commented 3 years ago

Yea took me forever to debug. Turns out sending a command in econ that is too long. Something like 1500 characters just kills the connection. Probably some limit in the teeworlds code? And since the production settings included a lot of filtered words and banned vote reasons. The initial print of the current settings exceeded that limit. Now log() does chop too long strings.