robhowley / nhlscrapi

Python based web scraper API for NHL game data
Apache License 2.0
69 stars 28 forks source link

Error using Roster summary #19

Open buddha314 opened 6 years ago

buddha314 commented 6 years ago

The following code

from nhlscrapi.games.game import GameKey, Game
from nhlscrapi.games.rosters import Rosters

gk = GameKey(2015, 2, 224)
r = Rosters(gk)
print(r.home_skaters)

Produces the following error:

python roster.py 
Traceback (most recent call last):
  File "roster.py", line 10, in <module>
    print(r.home_skaters)
  File "/Users/buddha/github/buddha314/nhl-quant-experiments/env/lib/python2.7/site-packages/nhlscrapi/games/repscrwrap.py", line 25, in wrapped
    self._loaded[l] = getattr(attr, loader_name)() is not None
  File "/Users/buddha/github/buddha314/nhl-quant-experiments/env/lib/python2.7/site-packages/nhlscrapi/scrapr/rosterrep.py", line 95, in parse_rosters
    self.rosters[t] = self.__clean_pl_block(self.__blocks[t])
  File "/Users/buddha/github/buddha314/nhl-quant-experiments/env/lib/python2.7/site-packages/nhlscrapi/scrapr/rosterrep.py", line 60, in __clean_pl_block
    num = int(txt[0]) if txt[0].isdigit() else max(r.keys())+1
ValueError: max() arg is an empty sequence

It wouldn't surprise me at all if I was using the library incorrectly. Please let me know what I'm doing wrong. Thanks!