You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try the basic "quick start" for loading in a sleeper league, I get a KeyError: 7. Will post the full log below. Wondering if it has to do with a team that the owner was removed and is now just an NPC team. Also, sorry if this is mentioned somewhere in the README or anything, I wasn't able to find it.
League Info
League ID: 1000931507806011392
Season: 2023
Error Logs
KeyError Traceback (most recent call last)
Cell In[8], line 2
1 sleeperLeagueLoader = SleeperLeagueLoader("1000931507806011392", [2023])
----> 2 League = sleeperLeagueLoader.loadLeague()
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:121, in SleeperLeagueLoader.loadLeague(self, validate)
119 def loadLeague(self, validate: bool = True) -> League:
120 sleeperLeagues = self.__getAllLeagues()
--> 121 league = self.__buildLeague(sleeperLeagues)
122 if validate:
123 # validate new league
124 leagueValidation.runAllChecks(league)
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:136, in SleeperLeagueLoader.__buildLeague(self, sleeperLeagues)
133 for sleeperLeague in sleeperLeagues:
134 # save league name for each year
135 self._leagueNameByYear[int(sleeperLeague.season)] = sleeperLeague.name
--> 136 years.append(self.__buildYear(sleeperLeague))
137 return League(name=self._getLeagueName(), owners=owners, years=self._getValidYears(years))
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:192, in SleeperLeagueLoader.__buildWeeks(self, sleeperLeague)
189 for sleeperMatchupPair in sleeperMatchupIdToSleeperMatchupMap.values():
190 # team A
191 teamASleeperMatchup = sleeperMatchupPair[0]
--> 192 teamA = self.__sleeperRosterIdToTeamMap[teamASleeperMatchup.roster_id]
194 # team B
195 teamBSleeperMatchup = sleeperMatchupPair[1]
KeyError: 7
The text was updated successfully, but these errors were encountered:
I'm also getting a key error when trying to compile an all-time statsheet from Sleeper. I don't have any users that changed usernames, but do have several owners leaving and new owners from one year to the next.
Error Logs
Traceback (most recent call last):
File "/Users/ryan.gillies/Documents/side_judge/backend/models/league.py", line 91, in _load_leeger
leagueStats: AllTimeStatSheet = leagueStatSheet(leeger, validate = True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan.gillies/Documents/side_judge/.venv/lib/python3.11/site-packages/leeger/util/stat_sheet.py", line 81, in leagueStatSheet
maxScoringShare = ScoringShareAllTimeCalculator.getMaxScoringShare(league, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan.gillies/Documents/side_judge/.venv/lib/python3.11/site-packages/leeger/decorator/validators.py", line 38, in wrapFunction
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan.gillies/Documents/side_judge/.venv/lib/python3.11/site-packages/leeger/calculator/all_time_calculator/ScoringShareAllTimeCalculator.py", line 143, in getMaxScoringShare
maxScoringSharesByYear[yearNumber][ownerId]
KeyError: '506256e003f911efba5b5af986bf8fed'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
Code
def _load_leeger(self):
from leeger.league_loader import SleeperLeagueLoader
from leeger.model.league import League, Year
from leeger.model.stat.YearStatSheet import YearStatSheet
from leeger.util.stat_sheet import yearStatSheet, leagueStatSheet
from leeger.model.stat.AllTimeStatSheet import AllTimeStatSheet
league_loader = SleeperLeagueLoader(self.league_id, self.years)
leeger: League = league_loader.loadLeague()
from leeger.model.stat.AllTimeStatSheet import AllTimeStatSheet
from leeger.util.stat_sheet import leagueStatSheet
try:
leagueStats: AllTimeStatSheet = leagueStatSheet(leeger, validate = True)
except KeyError:
import traceback
traceback.print_exc()
return leeger
League Loader
Sleeper
Summary
When I try the basic "quick start" for loading in a sleeper league, I get a KeyError: 7. Will post the full log below. Wondering if it has to do with a team that the owner was removed and is now just an NPC team. Also, sorry if this is mentioned somewhere in the README or anything, I wasn't able to find it.
League Info
League ID: 1000931507806011392
Season: 2023
Error Logs
KeyError Traceback (most recent call last)
Cell In[8], line 2
1 sleeperLeagueLoader = SleeperLeagueLoader("1000931507806011392", [2023])
----> 2 League = sleeperLeagueLoader.loadLeague()
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:121, in SleeperLeagueLoader.loadLeague(self, validate)
119 def loadLeague(self, validate: bool = True) -> League:
120 sleeperLeagues = self.__getAllLeagues()
--> 121 league = self.__buildLeague(sleeperLeagues)
122 if validate:
123 # validate new league
124 leagueValidation.runAllChecks(league)
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:136, in SleeperLeagueLoader.__buildLeague(self, sleeperLeagues)
133 for sleeperLeague in sleeperLeagues:
134 # save league name for each year
135 self._leagueNameByYear[int(sleeperLeague.season)] = sleeperLeague.name
--> 136 years.append(self.__buildYear(sleeperLeague))
137 return League(name=self._getLeagueName(), owners=owners, years=self._getValidYears(years))
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:147, in SleeperLeagueLoader.__buildYear(self, sleeperLeague)
143 self._sleeperDivisionIdToDivisionMap[divisionNumber] = Division(
144 name=getattr(sleeperLeague.metadata, f"division{divisionNumber}")
145 )
146 teams = self.__buildTeams(sleeperLeague)
--> 147 weeks = self.__buildWeeks(sleeperLeague)
148 # add YearSettings
149 yearSettings = YearSettings()
File ~\anaconda3\envs\py36\Lib\site-packages\leeger\league_loader\SleeperLeagueLoader.py:192, in SleeperLeagueLoader.__buildWeeks(self, sleeperLeague)
189 for sleeperMatchupPair in sleeperMatchupIdToSleeperMatchupMap.values():
190 # team A
191 teamASleeperMatchup = sleeperMatchupPair[0]
--> 192 teamA = self.__sleeperRosterIdToTeamMap[teamASleeperMatchup.roster_id]
194 # team B
195 teamBSleeperMatchup = sleeperMatchupPair[1]
KeyError: 7
The text was updated successfully, but these errors were encountered: