BurntSushi / nfldb

A library to manage and update NFL data in a relational database.
The Unlicense
1.08k stars 264 forks source link

New Season #304

Open ToddAtWSU opened 6 years ago

ToddAtWSU commented 6 years ago

So I'm trying to get this running again for the new year and am struggling. I actually got a new computer and had to install Python and nflgame fresh. After installing it, I tried to run the nflgame-update-players and it spit out the following errors:

============ RESTART: C:\Python27\Scripts\nflgame-update-players ============
Loading games for POST 2017 week 4
Downloading team rosters...

1/32 complete. (3.12%)
2/32 complete. (6.25%)
3/32 complete. (9.38%)
4/32 complete. (12.50%)
5/32 complete. (15.62%)
6/32 complete. (18.75%)
7/32 complete. (21.88%)
8/32 complete. (25.00%)
9/32 complete. (28.12%)
10/32 complete. (31.25%)
11/32 complete. (34.38%)
12/32 complete. (37.50%)
13/32 complete. (40.62%)
14/32 complete. (43.75%)
15/32 complete. (46.88%)
16/32 complete. (50.00%)
17/32 complete. (53.12%)
18/32 complete. (56.25%)
19/32 complete. (59.38%)
20/32 complete. (62.50%)
21/32 complete. (65.62%)
22/32 complete. (68.75%)
23/32 complete. (71.88%)
24/32 complete. (75.00%)
25/32 complete. (78.12%)
26/32 complete. (81.25%)
27/32 complete. (84.38%)
28/32 complete. (87.50%)
29/32 complete. (90.62%)
30/32 complete. (93.75%)
31/32 complete. (96.88%)
32/32 complete. (100.00%)
Done!
Fetching GSIS identifiers for players not in nflgame...

1/1 complete. (100.00%)
Done!

There were some errors during the download. Usually this is a
result of an HTTP request timing out, which means the
resulting "players.json" file is probably missing some data.
An appropriate solution is to re-run the script until there
are no more errors (or when the errors are problems on 
NFL.com side.)
-------------------------------------------------------------------------------
Could not get player info from roster row:

<tr class="even">
<td>72</td>
<td style="text-align:left"> <a href="/player/charleslenojr./2550169/profile">Leno, Charles, Jr.</a></td>
<td>OT</td>
<td>ACT</td>
<td> 6'3"</td>
<td>306</td>
<td>10/9/1991</td>
<td>5</td>
<td>Boise State</td></tr>

Exception:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\nflgame\update_players.py", line 419, in run
    roster.append(meta_from_soup_row(team, row))
  File "C:\Python27\lib\site-packages\nflgame\update_players.py", line 179, in meta_from_soup_row
    last_name, first_name = map(lambda s: s.strip(), name.split(','))
ValueError: too many values to unpack

-------------------------------------------------------------------------------
Could not get GSIS id at http://www.nfl.com/player/cedwilson/2560936/profile
-------------------------------------------------------------------------------
Could not find gsis_id for {'status': u'RES', 'last_name': u'Wilson', 'weight': 197, 'profile_id': 2560936, 'number': 16, 'height': 74, 'college': u'Boise State', 'full_name': u'Ced Wilson', 'first_name': u'Ced', 'years_pro': 0, 'birthdate': u'3/10/1995', 'team': 'DAL', 'position': u'WR', 'profile_url': u'http://www.nfl.com/player/cedwilson/2560936/profile'}
>>> 

Did I do something wrong? Also, what do I need to do to get 2018 games to work? I tried this.

>>> game = nflgame.one(2018, 1, "ATL", "PHI")
>>> print game
None
lopezgd commented 6 years ago

The error in update_players.py is because it is trying to unpack 'Leno', 'Charles' and 'Jr.' into last_name, first_name. The script will have to be modified to handle this corner case.

To get the 2018 games, you have to modify the _CUR_SCHEDULE variable in live.py to point to the regular season URL, 'http://www.nfl.com/liveupdate/scorestrip/ss.xml' This is currently commented out and pointing to the postseason URL.

MargareeMan commented 6 years ago

See the following issue on Derek's fork: https://github.com/derek-adair/nflgame/issues/13

@hoopghetto (Aug 24) suggested adding two lines of codes to update_players.py after line 175:

176 if name.count(',') == 2: 177 name = name.strip(', Jr.')

THIS CLEARED up the Leno Jr. "corner case" for me.

The issues with "Ced Wilson" is simply that NFL has not yet provided a GSIS id for him. (See @ochawkeye post in the same thread.