MLB-LED-Scoreboard / mlb-led-scoreboard

An LED scoreboard for Major League Baseball :baseball:
GNU General Public License v3.0
582 stars 105 forks source link

Game data missing broadcast or series status throws an exception #443

Closed ty-porter closed 1 year ago

ty-porter commented 1 year ago

Game.from_scheduled does not handle fetching missing keys from dicts correctly.

C:\Users\tyler\development\mlb-led-scoreboard>python main.py
ERROR (12:09:47): Untrapped error in main!
Traceback (most recent call last):
  File "main.py", line 138, in <module>
    main(matrix, config)
  File "main.py", line 59, in main
    data = Data(config)
  File "C:\Users\tyler\development\mlb-led-scoreboard\data\__init__.py", line 25, in __init__
    self.current_game: Game = self.schedule.get_preferred_game()
  File "C:\Users\tyler\development\mlb-led-scoreboard\data\schedule.py", line 93, in get_preferred_game
    return self.__current_game()
  File "C:\Users\tyler\development\mlb-led-scoreboard\data\schedule.py", line 149, in __current_game
    return Game.from_scheduled(scheduled_game)
  File "C:\Users\tyler\development\mlb-led-scoreboard\data\game.py", line 31, in from_scheduled
    game_data["series_status"] or "",
KeyError: 'series_status'
WardBrian commented 1 year ago

Did this happen with an up-to-date StatsAPI?

ty-porter commented 1 year ago

Ah, no, this was behind with 1.5.1 instead of 1.6.1, so this can be closed.