uberfastman / fantasy-football-metrics-weekly-report

Command line application to create weekly reports (containing stats, metrics, and rankings) for Fantasy Football leagues on the following platforms: Yahoo, ESPN, CBS, Sleeper, Fleaflicker
GNU General Public License v3.0
199 stars 49 forks source link

[Bug] AttributeError: 'NoneType' object has no attribute 'get' #186

Closed ghost closed 1 year ago

ghost commented 1 year ago

Description of Issue

I couldn't figure out how to attach PyCharm debugger to the docker image, so pasting the CMD error below. It runs for about 5 minutes before failing.

Additional Information as Applicable

Fantasy Football Platform

Yahoo

League ID

189211

Operating System

Windows

Other

\fantasy-football-metrics-weekly-report>docker exec -it fantasy-football-metrics-weekly-report-app-1 python main.py
[2023-01-07 12:40:54,597 DEBUG] [git.util.util.is_cygwin_git] Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'No such file or directory')
2023-01-07 12:40:58,803 - utils.report_tools - INFO - The Fantasy Football Metrics Weekly Report app is up to date and running v14.0.1.
Generate report for default league? (y/n) -> y
Generate report for default week? (y/n) -> y
2023-01-07 12:41:12,604 - report.builder - INFO -
Generating Yahoo Fantasy Football report with settings:
    league id: 189211
    game id: nfl
    week: selected/default
    start_week: default=1
    save_data: False
    refresh_web_data: False
    playoff_prob_sims: None
    break_ties: False
    dq_ce: False
    dev_offline: False
    test: False
on Jan 07, 2023...
2023-01-07 12:41:12,607 - report.builder - INFO - Retrieving fantasy football data from Yahoo API...
Traceback (most recent call last):
  File "/app/main.py", line 273, in <module>
    report = select_league(
  File "/app/main.py", line 157, in select_league
    return FantasyFootballReport(week_for_report=week_for_report,
  File "/app/report/builder.py", line 101, in __init__
    self.league = league_data_factory(
  File "/app/utils/report_tools.py", line 477, in league_data_factory
    return yahoo_league.map_data_to_base(BaseLeague)
  File "/app/dao/platforms/yahoo.py", line 450, in map_data_to_base
    league_team = league.teams_by_week.get(str(week)).get(str(team_id))  # type: BaseTeam
AttributeError: 'NoneType' object has no attribute 'get'
uberfastman commented 1 year ago

@dac5039 so this is a pretty late response, but I finally had the chance to tackle bug tickets so here we are. I just published #188, which includes a bunch of improvements, bug fixes, and upgrades, and also uses the latest version of YFPY (which is my separate Yahoo Fantasy API wrapper that this app also uses), which includes some nice improvements to interacting with Yahoo Fantasy API data.

That being said, looking at the stack trace above, and the date at which you were trying to run the report, it seems like it might be possible you were trying to generate it for FF playoffs? If that's the case, unfortunately this app does not support playoffs as there are just too many varieties of playoffs across all platforms to support given the time I have to do so. However if I'm wrong, please let me know and I'm happy to try and figure this out in the even that you're still experiencing it, although I'm hoping that my latest update will take care of it in that case!

uberfastman commented 1 year ago

Closing this as I think it should be fixed. Feel free to reopen if it persists.