help getting historical scores
Closed this issue · 2 comments
rfcohen commented
All I want is all the scores from a particular day in a computable form.
Seems like this library should do it for me. As I'm tinkering with it I keep getting this error:
Traceback (most recent call last):
File "/Users/cohenrf/Documents/Dev/RollOverRuns/RollOverRuns.py", line 12, in <module>
scoreboard = mlbgame.box_score(game)
File "/Users/cohenrf/Documents/Dev/RollOverRuns/venv/lib/python3.6/site-packages/mlbgame/__init__.py", line 190, in box_score
data = mlbgame.game.box_score(game_id)
File "/Users/cohenrf/Documents/Dev/RollOverRuns/venv/lib/python3.6/site-packages/mlbgame/game.py", line 230, in box_score
data = mlbgame.data.get_box_score(game_id)
File "/Users/cohenrf/Documents/Dev/RollOverRuns/venv/lib/python3.6/site-packages/mlbgame/data.py", line 57, in get_box_score
year, month, day = get_date_from_game_id(game_id)
File "/Users/cohenrf/Documents/Dev/RollOverRuns/venv/lib/python3.6/site-packages/mlbgame/data.py", line 156, in get_date_from_game_id
year, month, day, _discard = game_id.split('_', 3)
AttributeError: 'GameScoreboard' object has no attribute 'split'
with this code:
import mlbgame
games = mlbgame.day(2018, 8, 4)
print (len(games))
for game in games:
scoreboard = mlbgame.box_score(game)
game.nice_score()))
print (game.nice_score())
take out the box_score()
call and it runs but I don't get the answer I want.
panzarino commented
Change this line scoreboard = mlbgame.box_score(game)
to scoreboard = mlbgame.box_score(game.game_id)
in order to get rid of that error.
rfcohen commented
Fixed it. thanks for the 'duh' type question.