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

2017 week 1 data is missing #331

Open
nbkincaid opened this issue Sep 16, 2017 · 16 comments
Open

2017 week 1 data is missing #331

nbkincaid opened this issue Sep 16, 2017 · 16 comments

Comments

@nbkincaid
Copy link

nbkincaid commented Sep 16, 2017

It's Friday during week 2 and only the data from the week 2 Thursday game is returned in the following:

import nflgame
nflgame.games(2017)
[<nflgame.game.Game object at 0x11197bf50>]

Is this intended behavior, or is this an issue? Is there a way to get the week 1 data still?

Thank you!

@zag2me
Copy link

zag2me commented Sep 16, 2017

My Site has an auto NFL importer but its broken and I couldn't work out why, maybe this is it!

http://www.thesportsdb.com/league/4391

Hope it gets fixed.

@ochawkeye
Copy link
Contributor

Not an issue I'm seeing.

import nflgame
games = nflgame.games(2017)
print len(games)
30

That's 15 games for week 1 + 15 games played as of Sunday night in week 2.

Try updating 2017 with update_sched.py found in your nflgame directory.

C:\Python27\Lib\site-packages\nflgame>python update_sched.py --year 2017
Last updated: 2017-09-18 01:53:15.482000
Updating (2017, PRE, 0)...
Updating (2017, PRE, 1)...
Updating (2017, PRE, 2)...
Updating (2017, PRE, 3)...
Updating (2017, PRE, 4)...
Updating (2017, REG, 1)...
Updating (2017, REG, 2)...
Updating (2017, REG, 3)...
Updating (2017, REG, 4)...
Updating (2017, REG, 5)...
Updating (2017, REG, 6)...
Updating (2017, REG, 7)...
Updating (2017, REG, 8)...
Updating (2017, REG, 9)...
Updating (2017, REG, 10)...
Updating (2017, REG, 11)...
Updating (2017, REG, 12)...
Updating (2017, REG, 13)...
Updating (2017, REG, 14)...
Updating (2017, REG, 15)...
Updating (2017, REG, 16)...
Updating (2017, REG, 17)...
Updating (2017, POST, 1)...
Updating (2017, POST, 2)...
Updating (2017, POST, 3)...
Updating (2017, POST, 4)...

@zag2me
Copy link

zag2me commented Sep 18, 2017

Perfect! works again now.

Did I just miss something in the documentation? I had no idea this needed to be done. Thanks again.

@ochawkeye
Copy link
Contributor

You didn't miss anything. Changing seasons has always proven to be a bit problematic.

I'm not positive on this, but I think this mostly has to do with the fact that - by design - the schedule is not rebuilt every time update_sched is run unless explicitly told to do so. Only the current week is updated by default if necessary. So if you miss week(s) at the start of a season those weeks are not attempted to be updated unless told to specifically with --year ####.

Not sure if it would resolve this entirely, but in addition to last_updated being updated/checked in schedule.json maybe we could also include there the schedule URL that was last used to update the schedule. If a different URL was used this time than last time, then instead of only updating the week, the entire current year would be updated.

@jamesyh
Copy link

jamesyh commented Sep 23, 2017

I'm getting a weird issue now. It worked a few days ago for week 1 of 2017 but now nflgame.games(year=2017,week=1) returns:

Traceback (most recent call last):
File "", line 1, in
File "c:\Users\jamhill\Documents\Python\football\lib\site-packages\nflgame_init_.py", line 229, in games
return list(games_gen(year, week, home, away, kind, started))
TypeError: 'NoneType' object is not iterable

But it works fine for other years and for week 3. Any ideas for why this would be happening?

@BadLuckRestaurant
Copy link

BadLuckRestaurant commented Sep 30, 2017

same problems for me, only for this year weeks I've this error
Traceback (most recent call last):
File "<pyshell#10>", line 1, in
nflgame.combine(nflgame.games(2017,week=3))
File "C:\Python27\lib\site-packages\nflgame_init_.py", line 229, in games
return list(games_gen(year, week, home, away, kind, started))
TypeError: 'NoneType' object is not iterable

@BadLuckRestaurant
Copy link

running
pip install git+https://github.com/BurntSushi/nflgame.git
instead of
pip install nflgame
it works!

@derek-adair
Copy link
Contributor

This is almost certainly an issue importing the schedule.

What do you see when you run...

import nflgame
nflgame.sched.last_updated

@jamesyh
Copy link

jamesyh commented Oct 5, 2017

nflgame.sched.last_updated
datetime.datetime(2017, 10, 5, 8, 56, 8, 704000)

@jamesyh
Copy link

jamesyh commented Oct 5, 2017

BadLuckRestaurant's solution worked. Thanks!

@eshickey
Copy link

eshickey commented Nov 19, 2017

I think I'm missing something here. I'm running a script and getting the following error. I can pull data from prior to 2016, but nothing from 2017. I have run the update_sched with the following results: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

======= RESTART: C:\Python27\Lib\site-packages\nflgame\update_sched.py =======
Last updated: 2017-11-19 14:48:41.606000

But when I run the script, I still get the following error:
Traceback (most recent call last):
File "C:\Python27\Week 9.py", line 3, in
games = nflgame.games(2017, week=10)
File "C:\Python27\lib\site-packages\nflgame_init_.py", line 229, in games
return list(games_gen(year, week, home, away, kind, started))
TypeError: 'NoneType' object is not iterable

I also tried to pull the file that BadLuckResturant mentions, and get an error trying to locate the file.

@ariannedee
Copy link

ariannedee commented Nov 22, 2017

I had tried to pip install from git and update the schedule, as others have mentioned, but I was still having issues keeping the games up to date. Here is what I did to get it working reliably on a Heroku environment using pipenv.


Solution

There is a line in nflgame/live.py that is using the post season url and not the regular season url to update schedule.json 🙀.

So in nflgame/live.py, line 73 needs to be commented out and line 68 commented in.

This issue has been addressed by someone else in the open PR #317.


I believe if you do that, then it doesn't matter that you're using an older version of schedule.json since it will be updated dynamically from the URL (so using the latest git version doesn't matter). If the file isn't updating because it says it's already up to date, you can edit the timestamp at the very bottom of schedule.json to some time before the game it is you want to update. (For me it was MIA vs TB on Nov 19, 2017 that was missing, 2017111911).

I ended up forking the repo and pipenv installing that version in edit mode instead.
pipenv install -e git+https://github.com/denimandsteel/nflgame.git#egg=nflgame

After that is installed, then you can run:
python path/to/nflgame/update_sched.py --year 2017 or nfldb-update --update-schedules (if you're using nfldb)

@jason-tilley
Copy link

jason-tilley commented Nov 22, 2017

Thank you ariannedee! Uncommenting and commenting the appropriate lines fixed the problem with update_sched.py. Unfortunately, I'm still having issues with update_players.py. I get the following (maybe it's related to the Jr.):

`Loading games for REG 2017 week 11
Downloading team rosters...
32/32 complete. (100.00%)
Done!

There were some errors during the download. Usually this is a
result of an HTTP request timing out, which means the
resulting "players.json" file is probably missing some data.
An appropriate solution is to re-run the script until there
are no more errors (or when the errors are problems on
NFL.com side.)


Could not get player info from roster row:

72 Leno, Charles, Jr. OT ACT 6'3" 306 10/9/1991 4 Boise State

Exception:

Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nflgame/update_players.py", line 419, in run
roster.append(meta_from_soup_row(team, row))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nflgame/update_players.py", line 179, in meta_from_soup_row
last_name, first_name = map(lambda s: s.strip(), name.split(','))
ValueError: too many values to unpack
`

Sorry, I don't know how to disable the markdown.

@jason-tilley
Copy link

OK, if I install using:

sudo pip install -e git+https://github.com/denimandsteel/nflgame.git#egg=nflgame

on my Mac, it seems to be working.

@ariannedee
Copy link

ariannedee commented Nov 22, 2017

@ForTozs Yeah, that Leno, Charles Jr. issue has been a problem for a while. There are a few PRs to address it but I put a fix for that in my fork as well. Glad it worked!

(If you add a newline above the dashes for the horizontal line, then the text above won't show up as a heading. I guess it's treating it as ReStructuredText rts headings.)

@nrosjat
Copy link

nrosjat commented Mar 30, 2018

I just installed nflgame by

pip2 install nflgame

but I guess I have to apply some changes to update the last season?

import nflgame
games = nflgame.games(2017)
print len(games)

16

I ran python update_sched.py --year 2017 several times, but it didn't change the schedule at all (eventhough it said "updating (2017, Pre-Post ...) ). Any ideas what I could do?

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

10 participants