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

Closed
opened 2026-03-02 15:55:34 +03:00 by kerem · 2 comments
Owner

Originally created by @ckim16 on GitHub (Oct 18, 2023).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/413

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?

Originally created by @ckim16 on GitHub (Oct 18, 2023). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/413 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?
kerem 2026-03-02 15:55:34 +03:00
  • closed this issue
  • added the
    bug
    SoFIFA
    labels
Author
Owner

@ckim16 commented on GitHub (Oct 24, 2023):

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

<!-- gh-comment-id:1776586412 --> @ckim16 commented on GitHub (Oct 24, 2023): 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
Author
Owner

@probberechts commented on GitHub (Oct 24, 2023):

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
<!-- gh-comment-id:1776589243 --> @probberechts commented on GitHub (Oct 24, 2023): 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 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#77
No description provided.