Closed joeycortez42 closed 6 years ago
Not sure what stats_home and stats_away are but they do not exist, and makes this change fail.
@flipperbw What happens when you run this in a python file?
import nflgame
game = nflgame.one(2017, 1, 'CIN', 'BAL')
print game.home, game.stats_home.turnovers, 'turnovers'
print game.away, game.stats_away.turnovers, 'turnovers'
I wound up using #197 (with some fixes of its own, some typos there). So I'm not sure, but can't really go back to check. It said this though:
Traceback (most recent call last):
File "/usr/local/bin/nfldb-update", line 42, in <module>
nfldb.update.run(**vars(args))
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 574, in run
doit()
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 564, in doit
update_games(db, batch_size=batch_size)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 414, in update_games
update_current_week_schedule(db)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 321, in update_current_week_schedule
g = game_from_id(cursor, gsis_id)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 58, in game_from_id
return game_from_schedule(cursor, gsis_id)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 105, in game_from_schedule
return nfldb.Game._from_schedule(cursor.connection, s)
File "/usr/local/lib/python2.7/dist-packages/nfldb/types.py", line 2164, in _from_schedule
return Game._from_nflgame(db, _Game())
File "/usr/local/lib/python2.7/dist-packages/nfldb/types.py", line 2115, in _from_nflgame
dbg.home_turnovers = int(g.stats_home.turnovers)
AttributeError: '_Game' object has no attribute 'stats_home'
@flipperbw I got the same thing trying to update after this weeks games. But I ran it again and it worked. I feel like there is a cache issue with nfldb and nflgame. I'm going to modify the pull request to fix this.
Thanks!
@nokemono42 Were you able to fix the suspected cache issue with nfldb and nflgame? I'm using #287 and I'm still getting the following errors:
STARTING NFLDB UPDATE AT 2017-12-18 07:26:58.227374
Connecting to nfldb... done.
Setting timezone to UTC... done.
Locking write access to tables... done.
Updating season phase, year and week... done.
Bulk inserting data for 48 games...
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
done.
Updating schedule JSON database...
Last updated: 2017-12-18 13:24:01.532627
done.
Updating schedule for (Regular, 2017, 15)
Traceback (most recent call last):
File "/usr/local/bin/nfldb-update", line 42, in
@jayhova3g #287 Addresses this issue. I have been running it for a few weeks now with no problem.
Thank you for responding. I think I had an configuration error on my computer. I deleted and reinstalled #287. I haven't had anymore issues.
Modified version of #197.
Fixed home_turnovers and away_turnovers mapping from timeout mapping. Added command line option to update game turnovers.