-
Notifications
You must be signed in to change notification settings - Fork 112
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
XML Error pulling player stats #123
Comments
seems mlb changed the API on this. there is no data provided at gd2.mlb.com/components/game/mlb/year_2019/month_03/day_31/gid_2019_03_31_pitmlb_cinmlb_1/ Not sure what was different in the old api between boxscore and rawboxscore, but maybe they combined them? Not sure how to fix without knowledge of the data in rawboxscore vs boxscore |
I actually just solved this same issue, so here's what I did (sorry if there's a cleaner way to show it on GitHub, this is my first real contribution). In mlbgame folder:
Originally, it looked like this: Make it this:
Originally, they looked like this: Make them like these: I think those are the only two changes needed but, if you get an error, comb through the files again and see if anything else is pointing to rawboxscore. I read in one of the notes that MLB used to have two box scores and these scripts pulled both of them. It looks like MLB condensed it to one and the script was trying to still grab both. Rather than just delete that part of the code, I commented it out so I wasn't breaking too much. Good luck! |
@mmergola You're right! But you only need to make the change you reference in data.py (I think). Thanks for posting this! |
The |
@mmergola: Thx much! @jtonzi : I had success with just changing data.py as well. I did not change stats.py. @trevor-viljoen: Does making the single change prevent the backward compatibility issue? Simple testing on my part indicated that it worked for 2017 games, but there may be more advanced functionality than I am using. Again, many thanks. |
@Bill-M123 |
@trevor-viljoen Thx. I was just about to comment out my question. For my application, that means that all additional batting stats go away sine rawboxscore is removed. You answered this in another thread (#89), and I didn't catch the implication until this morning when I working on the prediction side of my problem... For me, the backward compatibility is actually a problem. If I use any additional info from previous years for training and it isn't available for predictions, that is problematic. I'll take a careful look at what is missing (which looked like "not much" on a quick look) and see if I can derive it, but my default plan is to just use the info available in boxscore/player_stats. Best |
Now that I'm understanding it all better, what everyone said above is correct (that it's necessary, but can survive with a try/except). I just used the link from trevor-viljoen to update my mlbstats.py script and changed the lines back to what they were for mlbdata.py. Basically, what I said in my first comment is flawed and only works if you don't care about prior years. If so, use trevor-viljoen's solution. |
Fix issue #123 when rawboxscore.xml is unavailable
The xml bug described in #121 appears to be fixed for the game overview but is still present for player stats. I've built from master and get the following result when trying to pull player stats from a completed game:
The text was updated successfully, but these errors were encountered: