Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ESPN league error when generating report #201

Open
h-r-x opened this issue Oct 24, 2023 · 8 comments
Open

[Bug] ESPN league error when generating report #201

h-r-x opened this issue Oct 24, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@h-r-x
Copy link

h-r-x commented Oct 24, 2023

Description of Issue

Reports have worked flawlessly on previous versions (used throughout the 2022 season), but after updating to current version for 2023 season, I have been getting the following issue when attempting to generate reports for a private ESPN league:

Traceback (most recent call last):
  File "/opt/ffmwr/main.py", line 299, in <module>
    report = select_league(
             ^^^^^^^^^^^^^^
  File "/opt/ffmwr/main.py", line 175, in select_league
    return FantasyFootballReport(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ffmwr/report/builder.py", line 105, in __init__
    self.league: BaseLeague = league_data_factory(
                              ^^^^^^^^^^^^^^^^^^^^
  File "/opt/ffmwr/utilities/app.py", line 191, in league_data_factory
    return espn_league.map_data_to_base()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ffmwr/dao/platforms/espn.py", line 336, in map_data_to_base
    team_score = team.scores[week_for_matchups - 1]
                 ^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'scores'

I attempted to generate for default week as well as numerous other weeks (1-8) to see if that would help, but no luck.

Fantasy Football Platform

ESPN

Operating System

Windows

Also just wanted to say that I've loved this repo and thank you for your work on this.

@h-r-x h-r-x added the bug Something isn't working label Oct 24, 2023
@uberfastman
Copy link
Owner

uberfastman commented Oct 24, 2023

Hi @h-r-x, thanks for the bug report. I just tried generating a report for a private ESPN league using v16.0.1 (the latest published version), and it worked without issue. There was a change to the third-party library I use to pull ESPN data... could you try running pip install -r requirements.txt (or if you're using the docker container, run docker compose build --no-cache to recreate the image before startup), and then try running a report?

Also thanks for your longtime support, I'm glad that the app is still providing value to people in the FF community!

@h-r-x
Copy link
Author

h-r-x commented Oct 24, 2023

Thanks for the reply! I did what you suggested and it did update a few missing requirements. Still getting the same exact error as mentioned above unfortunately though.

I also tried a fresh clone, following all the steps again from the beginning, and that returned the same error again as well.

@uberfastman
Copy link
Owner

@h-r-x did your league start in week 1 or a later week?

Also, on line 329 of dao/platforms/espn.py, could you add print(matchups_by_week) in share the output?

Your stack trace seems to indicate that the matchup teams are integers, but they should be of type espn_api.football.team.Team.

@h-r-x
Copy link
Author

h-r-x commented Oct 24, 2023

Week 1, yes, though this particular league does have an odd number of teams (7) this season, so teams all have 2 Bye weeks. Could that be what is returning integers?

Also, I'm having trouble getting an output. When I run the file it had multiple problems, most of which I resolved (simply python version mismatch), but I am now getting:

Traceback (most recent call last):
  File "c:\Users\name\Documents\fantasy-football-metrics-weekly-report\dao\platforms\espn.py", line 29, in <module>
    from dao.base import BaseMatchup, BaseTeam, BaseRecord, BaseManager, BasePlayer, BaseStat
ModuleNotFoundError: No module named 'dao'

Another thing I noticed is that the out log states:

2023-10-24 20:44:17,926 - utilities.app - INFO - The Fantasy Football Metrics Weekly Report app is up to date and running v16.0.0.

I double checked compose.yaml and it does correctly show image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:16.0.1 there.

@uberfastman
Copy link
Owner

uberfastman commented Oct 24, 2023

When I run the file

Were you trying to run only that file? My apologies if I was unclear, what I meant was for you to add the print statement and then run the report as you normally would.

Also, that's odd about the version... am I correct in assuming you're using docker to run the report?

Lastly, I have actually never tested the app on leagues without even numbers of teams... so I honestly have no idea how it will behave, so that seems a likely culprit for the missing team data, since the report has no concept of bye weeks (it does not support being run during fantasy playoffs, for instance). Without the ability to see what the data returned from the ESPN API looks like in your specific scenario, I'll have trouble trying to support it. If you're interested though and don't mind, you can always add me as a comanager to your team on ESPN so I can get at your private league data to test it out, but that's up to you. If you want to try that then let me know and I can share my ESPN FF account email that you would invite.

@h-r-x
Copy link
Author

h-r-x commented Oct 24, 2023

Yeah I'm using docker. Also I tried that, but it's not printing it when attempting to generate a report. All I get back is the same error as above.

Yeah I'm okay with you looking into it if you'd like to verify if that's the issue.

@uberfastman
Copy link
Owner

Yeah now that I know it's a 7 team league with bye weeks, I'm positive that is the reason you're getting your error. As I mentioned, I have never had the opportunity to test the app on a league with odd numbers of teams and bye weeks, so it's fairly safe to assume it'll break.

That being said, if you're interested in me looking into how feasible it would be to support your configuration and you're comfortable with me existing as a "shadow" co-manager on your team in that league in order to access the data, then you can email me at uberfastman@uberfastman.dev and I'll get back to you with my ESPN account email.

@h-r-x
Copy link
Author

h-r-x commented Oct 25, 2023

Thanks, sent you an email. I'll leave this issue open to you to decide how to close it once you can get in and diagnose it better. Appreciate the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants