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

NFLDB-Update not updating rosters #47

Open
iliketowel opened this issue Aug 16, 2014 · 5 comments
Open

NFLDB-Update not updating rosters #47

iliketowel opened this issue Aug 16, 2014 · 5 comments

Comments

@iliketowel
Copy link

>>> C:\Python27\Scripts>python nfldb-update
-------------------------------------------------------------------------------
STARTING NFLDB UPDATE AT 2014-08-16 09:25:50.151000
Connecting to nfldb... done.
Setting timezone to UTC... done.
Updating player JSON database... (last update was 2014-08-13 00:07:18.078000+00:
00)
Loading games for PRE 2014 week 2
Downloading team rosters...
1/32 complete. (3.12%)Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\lib\site-packages\nflgame\update_players.py", line 479, in <
module>
    run()
  File "C:\Python27\lib\site-packages\nflgame\update_players.py", line 403, in r
un
    roster.append(meta_from_soup_row(team, row))
  File "C:\Python27\lib\site-packages\nflgame\update_players.py", line 161, in m
eta_from_soup_row
    profile_url = 'http:https://www.nfl.com%s' % tds[1].a['href']
IndexError: list index out of range
`C:\Python27\python.exe -m nflgame.update_players --no-block` failed (exit statu
s 1)
done.
Locking player table...
Updating 5946 players... done.
Locking write access to tables... done.
Updating season phase, year and week... done.
Bulk inserting data for 5 games...
        Sending batch of data to database.

For some reason, the rosters aren't updating (it says 1/32 complete) and there are some other errors. I'm not sure what is causing this.

@BurntSushi
Copy link
Owner

@iliketowel In the future, could you please put pasted code/error output inside code fences? A code fence looks like this:

\`\`\`
code or output goes here
\`\`\`

You should remove the \ though.

I've edited your comment to add those this time. :-)

@BurntSushi
Copy link
Owner

Regrettably, I can't reproduce this. I'm wondering if you try it again, will it work? (It could have been a temporary glitch in NFL.com.)

If it still doesn't work, could you please upgrade nflgame with pip install --upgrade nflgame and try it again? If it fails, please post the output message. There should be more details now.

@kennysushi
Copy link

kennysushi commented Sep 14, 2016

"If it still doesn't work, could you please upgrade nflgame with pip install --upgrade nflgame and try it again? If it fails, please post the output message. There should be more details now."

Having an issue when updating nfldb for the 2016 season week 1. I was able to correctly run nfldb-update, but it didn't actually change the database to include 2016 week 1 data. I upgraded nflgame as you suggested and after retrying nfldb-update I got a much more robust looking update!:

C:\Users...\AppData\Local\Continuum\Anaconda2\Scripts>python nfldb-update

STARTING NFLDB UPDATE AT 2016-09-14 11:27:41.507000
Connecting to nfldb... done.
Setting timezone to UTC... done.
Locking write access to tables... done.
Updating season phase, year and week... done.
Adding schedule data for 321 games... done.
Bulk inserting data for 81 games...
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Traceback (most recent call last):
File "nfldb-update", line 39, in
nfldb.update.run(**vars(args))
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\update.py", line 535, in run
doit()
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\update.py", line 525, in doit
update_games(db, batch_size=batch_size)
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\update.py", line 397, in update_games
bulk_insert_game_data(cursor, scheduled, batch_size=batch_size)
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\update.py", line 195, in bulk_insert_game_data
do()
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\update.py", line 188, in do
nfldb.db._big_insert(cursor, table, bulk[table])
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\nfldb\db.py", line 356, in _big_insert
% (table, insert_fields, values))
File "C:\Users\ksogi\AppData\Local\Continuum\Anaconda2\lib\site-packages\psycopg2\extras.py", line 223, in execute
return super(RealDictCursor, self).execute(query, vars)
psycopg2.IntegrityError: insert or update on table "play" violates foreign key constraint "play_pos_team_fkey"
DETAIL: Key (pos_team)=(LA) is not present in table "team".

that being said... there's still no new data when running a python query as in below. The below returns empty. I can get 2015 just fine. Any additional suggestions? Is it a problem I run python through spyder/anaconda stack?

import nfldb
import pandas as pd
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year= 2016, season_type='Regular')
for g in q.as_games():
    print(g)

[empty]

@ochawkeye
Copy link
Contributor

Try updating your nfldb install and see if that helps anything.

pip install --upgrade nfldb

@kennysushi
Copy link

thanks for the speedy reply! this solved my issue:

pip install --upgrade nfldb

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

4 participants