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

Month "7" is failing for any year given in mlbgames.games() #29

Closed
4score opened this issue Apr 28, 2017 · 7 comments
Closed

Month "7" is failing for any year given in mlbgames.games() #29

4score opened this issue Apr 28, 2017 · 7 comments
Labels

Comments

@4score
Copy link

4score commented Apr 28, 2017

Hey guys,

I'm running into a problem getting game information for the month of July. Whenever I run:

# when n is >= 2012
mlbgame.games(n,7)

I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/mlbgame/__init__.py", line 205, in games
    game = day(i, y, x, home=home, away=away)
  File "/usr/lib/python3.5/site-packages/mlbgame/__init__.py", line 175, in day
    data = mlbgame.game.scoreboard(year, month, day, home=home, away=away)
  File "/usr/lib/python3.5/site-packages/mlbgame/game.py", line 24, in scoreboard
    home_name = teams[0].attrib['name']
IndexError: list index out of range
>>> mlbgame.games(2012,7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/mlbgame/__init__.py", line 205, in games
    game = day(i, y, x, home=home, away=away)
  File "/usr/lib/python3.5/site-packages/mlbgame/__init__.py", line 175, in day
    data = mlbgame.game.scoreboard(year, month, day, home=home, away=away)
  File "/usr/lib/python3.5/site-packages/mlbgame/game.py", line 24, in scoreboard
    home_name = teams[0].attrib['name']
IndexError: list index out of range

Any idea what this could be?
Thanks for the help

@panzarino panzarino added the bug label Apr 28, 2017
@panzarino
Copy link
Owner

I'll check it out

@FlowFX
Copy link

FlowFX commented May 4, 2017

I can confirm this error.

@chrissmithto
Copy link

Yep, I am having the same issue.

@FlowFX
Copy link

FlowFX commented May 12, 2017

The bug is in mlbgame.game.scoreboard and occurs for days without any games scheduled. That's why it happens in July (all-star break) and October.

screen shot 2017-05-12 at 12 13 34

The parsed scoreboard data root is not empty. Therefore the for game in root loop runs, doesn't find any teams, but tries to access the teams list for that game.

@panzarino: hope this helps. You know better than me what should be happening here.

@panzarino
Copy link
Owner

@FlowFX great! I'm planning on working tonight on the library and I will try to fix that bug with a new release coming sometime tomorrow.

@panzarino
Copy link
Owner

Just released in v2.3.3.

@FlowFX
Copy link

FlowFX commented May 13, 2017

Awesome!

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

No branches or pull requests

4 participants