yahoofantasy icon indicating copy to clipboard operation
yahoofantasy copied to clipboard

Performances dump `player_stats` KeyError

Open j-krl opened this issue 2 months ago • 0 comments

I am running the command yahoofantasy dump -g nhl -s 2023 -o ./data/nhl-2023-performances.csv performances for my recently completed NHL league. All other dump commands are working fine, but this one raises

WARN: Failed to fetch week 1 stats for Aleksander Barkov (427.p.5981), trying again in 2 minutes

I thought it might some kind of ratelimit, but when I throw a breakpoint in, the traceback is as follows:

Traceback (most recent call last):
  File ".../venv/lib/python3.11/site-packages/yahoofantasy/cli/dump.py", line 54, in _player_out
    for stat in player.get_stats(week_num):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.11/site-packages/yahoofantasy/resources/player.py", line 23, in get_stats
    stats_data = self._fetch_stats(week_num)["player_stats"]
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'player_stats'

I believe the error is happening inside the player.get_stats(week_num) call inside _player_out. I didn't dig any further but can give a hand if needed.

j-krl avatar Apr 15 '24 22:04 j-krl