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

Issue loading game data from 2018 season wk 4 - in py3 branch #83

Closed
armstrys opened this issue Sep 21, 2019 · 19 comments
Closed

Issue loading game data from 2018 season wk 4 - in py3 branch #83

armstrys opened this issue Sep 21, 2019 · 19 comments

Comments

@armstrys
Copy link

Apologies if I have missed an explanation for what is happening here, but when I try to query 2018 data week by week I keep stalling out on week 4 of 2018. When I request the bulk of 2018 I have no issues
Specifically request week 4 like:
games = nflgame.games(2018, week=4)

I get the error 'NoneType' object is not iterable at line 224 return list(games_gen(year, week, home, away, kind, started))

Am I systematically doing something wrong here? Thanks.

@pwu97
Copy link

pwu97 commented Sep 23, 2019

getting the same error. 2018 and 2019 dont work right now.

@derek-adair
Copy link
Owner

I just pushed some updates from dev to py3. But i think this is likely related to #68.

@derek-adair
Copy link
Owner

nflgame._search_schedule(year=2018, week=4) is returning an empty set. Investigating....

@derek-adair
Copy link
Owner

The schedule data was corrupted somehow. The fix has been pushed to the dev branch. I will be deploying this fix and some other things on PyPi this week. You can install this branch locally in the meantime if you need.

@derek-adair
Copy link
Owner

Can you confirm this is no longer happening on the latest release?

pip install nflgame-redux=2.0.1b1

@armstrys
Copy link
Author

armstrys commented Sep 26, 2019

Ran without error! Thanks!

Edit: Actually just ran into a similar error trying to load 2017 wk 1...
games = nflgame.games(2017,week=1)
yields
AttributeError: 'NoneType' object has no attribute 'decode'

@armstrys
Copy link
Author

Following up on this... I am now seeing two separate issues. This same code snippet works fine for 2016

For season 2017
games = nflgame.games(2017,week=1)
still gives an empty object.

For 2018 I'm receiving an error at a different place:
plays = nflgame.combine_plays(games).filter(team=team)
yields,
KeyError: 'drives'

@pwu97
Copy link

pwu97 commented Sep 29, 2019

can confirm what ryscar13 said. i scraped the csv files for 2009-2017 games if you need it.

@derek-adair
Copy link
Owner

@pwu97 what do you mean scraped the csv files?

@lollipoll
Copy link

I ran into the 2017 week 1 problem as well. Does it have something to do with the postponed TB@MIA game? When I try to pull data from that game specifically, it gives me the exact same AttributeError as when I pull the entire week. All of the other games work as expected.

@emuelle2
Copy link

emuelle2 commented Oct 2, 2019

Using version nflgame-redux==2.0.1a1 (Python 3.7), I can run 2018 week 4 by setting week number to 4.142857142857142. 2017 week 1 also works without issue for me in this version. This returns values for games:

wk=nflgame.games(2018, week=4.142857142857142)
for t in wk:
    msg = '%s %s at %s %s; away passing yds = %s, home passing yds = %i'
    print(msg % (t.away, t.score_away, t.home, t.score_home, t.stats_away.passing_yds, t.stats_home.passing_yds))

@derek-adair
Copy link
Owner

Ya these all seem to be related to the schedule being corrupt and is exposed by the recent changes in nflgame.games.

You can see the latest releases here: https://pypi.org/manage/project/nflgame-redux/releases/

@Cjaimesg
Copy link

Hi, i found in the .json this

"2017091006",
{
"away": "TB",
"day": 10,
"eid": "2017091006",
"gamekey": "57241",
"home": "MIA",
"meridiem": "PM",
"month": 9,
"season_type": "REG",
"time": "1:00",
"wday": "Sun",
"week": 1,
"year": 2017
}

This match not exist http://www.nfl.com/liveupdate/game-center/2017091006/2017091006_gtd.json
This match have been moved to 2017111911 - http://dailydolphin.blog.palmbeachpost.com/2017/09/06/nfl-moves-miami-dolphins-game-vs-tampa-bay-buccaneers-to-nov-19/

http://www.nfl.com/liveupdate/game-center/2017111911/2017111911_gtd.json

@derek-adair
Copy link
Owner

Ya i'll probably just have to manually correct this until I have time to adjust schedule.json dynamically.

@Cjaimesg
Copy link

I Can help you to update Schedule.json

@derek-adair
Copy link
Owner

PRs for this would be greatly appreciated. I will set aside time this week to do some pushes that i've been putting off.

@morelandjs
Copy link

morelandjs commented Nov 17, 2019

This fixes the error, but I wouldn't say it's a particularly great fix. Modification to nflgame/game.py:

                     assert game.eid is not None
                 game.data['gcJsonAvailable'] = True
-            except ValueError:
+            except (ValueError, AttributeError):
                 return None

@derek-adair
Copy link
Owner

I'll get that in there for a quick fix. I've been pulled away from this project briefly and will be fixing things before the new year/playoffs.

@derek-adair
Copy link
Owner

closing b/c schedule. should be fixed.

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

No branches or pull requests

7 participants