probberechts / soccerdata

⛏⚽ Scrape soccer data from Club Elo, ESPN, FBref, FiveThirtyEight, Football-Data.co.uk, FotMob, Sofascore, SoFIFA, Understat and WhoScored.
https://soccerdata.readthedocs.io/en/latest/
Other
544 stars 95 forks source link

[SoFIFA] IndexError: list index out of range, for read_teams() #413

Closed ckim16 closed 9 months ago

ckim16 commented 9 months ago

i get the following error when trying to retrieve teams from SoFIFA read_teams() method.

   teams = soFiFa.read_teams()
            ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/soccerdata/sofifa.py", line 202, in read_teams
    team_link = node.xpath(".//td[@class='col-name-wide']/a")[0]
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

pretty new to python so not sure what's going on here.

anybody else had similar issue?

ckim16 commented 9 months ago

i still get the same error.

[10/23/23 23:03:01] INFO     Saving cached data to /Users/CheewoonKim/soccerdata/data/FBref                _common.py:91
                    INFO     No seasons provided. Will retrieve data for the last 5 seasons.              _common.py:290
                    INFO     Saving cached data to /Users/CheewoonKim/soccerdata/data/SoFIFA               _common.py:91
                    INFO     [1/1] Retrieving teams for ENG-Premier League in Oct 23, 2023 edition         sofifa.py:184
2023-10-23 23:03:01.676 Uncaught app exception
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "...../main.py", line 7, in <module>
    teams = soFiFa.read_teams()
            ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/soccerdata/sofifa.py", line 202, in read_teams
    team_link = node.xpath(".//td[@class='col-name-wide']/a")[0]
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

i tried pip install --upgrade soccer too but still doesn't work. what am i missing here? Thanks in advanced

probberechts commented 9 months ago

It is currently only fixed in the master branch. There is no new release on the master branch yet. The following should work:

pip install git+https://github.com/probberechts/soccerdata.git

or

pip install -i https://test.pypi.org/simple/ soccerdata