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

Calling box_score gives you an error if it's the top of an inning for a live game #127

Closed
AndrewYinLi opened this issue May 15, 2019 · 1 comment

Comments

@AndrewYinLi
Copy link
Contributor

AndrewYinLi commented May 15, 2019

When I try to call mlb.box_score(some_game_id) when it is the top of an inning of an ongoing game, I get get the following eror: ValueError: invalid literal for int() with base 10: ''. When it is the bottom of an inning everything is fine. Will look into a solution.

Edit: If a team scores during the top of an inning it begins to work.

Full traceback:
Traceback (most recent call last): File "C:\Users\andre\AppData\Local\Programs\Python\Python35\lib\site-packages\mlbgame\game.py", line 270, in __init__ 'home': int(data[x]['home']), ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 73, in <module> main() File "main.py", line 67, in main real_time_game() File "main.py", line 57, in real_time_game innings_list = mlb.box_score(game_id).__dict__["innings"] # Get list of innings. Each inning is a dict e.g. {'inning': 1, 'home': 1, 'away': 0} File "C:\Users\andre\AppData\Local\Programs\Python\Python35\lib\site-packages\mlbgame\__init__.py", line 192, in box_score obj = mlbgame.game.GameBoxScore(data) File "C:\Users\andre\AppData\Local\Programs\Python\Python35\lib\site-packages\mlbgame\game.py", line 279, in __init__ 'away': int(data[x]['away']) ValueError: invalid literal for int() with base 10: ''

@AndrewYinLi
Copy link
Contributor Author

@panzarino I made a pull request with changes that should resolve the issue

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

No branches or pull requests

2 participants