You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Some players don't have a personal stats page created for them yet, but contain a valid link on roster pages, such as Moses Brown for the Portland Trail Blazers. As implemented, the Roster module for the NBA does not check if the returned data from the page is empty, and will attempt to parse information from an object which is None. Instead, if a player's page is invalid, the module should fail-fast and return None for the player instead of attempting to parse information or handle other scenarios.
To Reproduce
Querying the Portland Trail Blazer's roster, especially Moses Brown's personal stats page, will throw an error.
Expected behavior
Any player which has an invalid page should have None returned for their information instead of throwing an error.
Desktop (please complete the following information):
OS: Ubuntu 18.04 (affects all)
Sportsreference Version: 0.4.5
Additional context
Traceback:
Traceback (most recent call last):
File "tests/exhaustive/test_nba.py", line 7, in <module>
for player in team.roster.players:
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/teams.py", line 209, in roster
return Roster(self._abbreviation, self._year)
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/roster.py", line 1199, in __init__
self._find_players(year)
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/roster.py", line 1323, in _find_players
player_instance = Player(player_id)
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/roster.py", line 170, in __init__
player_data = self._pull_player_data()
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/roster.py", line 487, in _pull_player_data
self._parse_player_information(player_info)
File "/home/runner/work/sportsreference/sportsreference/sportsreference/nba/roster.py", line 348, in _parse_player_information
value = utils._parse_field(PLAYER_SCHEME, player_info, short_field)
File "/home/runner/work/sportsreference/sportsreference/sportsreference/utils.py", line 190, in _parse_field
items = [i.text() for i in html_data(scheme).items()]
The text was updated successfully, but these errors were encountered:
Describe the bug
Some players don't have a personal stats page created for them yet, but contain a valid link on roster pages, such as Moses Brown for the Portland Trail Blazers. As implemented, the Roster module for the NBA does not check if the returned data from the page is empty, and will attempt to parse information from an object which is
None
. Instead, if a player's page is invalid, the module should fail-fast and returnNone
for the player instead of attempting to parse information or handle other scenarios.To Reproduce
Querying the Portland Trail Blazer's roster, especially Moses Brown's personal stats page, will throw an error.
Expected behavior
Any player which has an invalid page should have
None
returned for their information instead of throwing an error.Desktop (please complete the following information):
Additional context
Traceback:
The text was updated successfully, but these errors were encountered: