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

position_type KeyError #30

Open
ryanlaughlin opened this issue Aug 13, 2022 · 3 comments
Open

position_type KeyError #30

ryanlaughlin opened this issue Aug 13, 2022 · 3 comments

Comments

@ryanlaughlin
Copy link

I just ran a script for the first time in six months and I'm getting this error whenever calling roster

~/anaconda3/lib/python3.8/site-packages/yahoo_fantasy_api/team.py in roster(self, week, day)
     93                     plyr["position_type"] = next_item["position_type"]
     94                 else:
---> 95                     plyr["position_type"] = next(it)["position_type"]
     96                 plyr["eligible_positions"] = _compact_eligible_pos(next(it))
     97                 plyr["selected_position"] = _compact_selected_pos(next(it))

KeyError: 'position_type'
@DMcP89
Copy link
Contributor

DMcP89 commented Aug 25, 2022

@ryanlaughlin can you post the script you are running or provide a link to it?

@gitJDJ
Copy link

gitJDJ commented Sep 8, 2022

I ran into this same issue trying to get rosters from a fantasy football league. I discovered that the objectpath filter was pulling a {status: False} for each player in addition to a player's status on injury, suspension, etc.

I resolved the issue by redefining the 'it' variable after Lines 71-73 as follows:
it = iter([item for item in it if item != {'status': False}])

@gitJDJ
Copy link

gitJDJ commented Sep 8, 2022

I ran into this same issue trying to get rosters from a fantasy football league. I discovered that the objectpath filter was pulling a {status: False} for each player in addition to a player's status on injury, suspension, etc.

I resolved the issue by redefining the 'it' variable after Lines 71-73 as follows: it = iter([item for item in it if item != {'status': False}])

Ah, now that I cloned the repo I see this was only a problem in my original installation and has since been resolved. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants