[GH-ISSUE #629] [FBref] Available leagues in docs do not match current FBref available leagues #123

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

Originally created by @ethanfinkel on GitHub (Jul 5, 2024).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/629

Hey team,

I found this issue in the docs as I was getting set up and thought I'd flag it. Awesome package by the way!

The docs have instructions for pulling EPL data from FBref, but the EPL is not a valid league for FBref currently. This leads to an error when following the docs verbatim.

Docs

Screenshot 2024-07-05 at 10 59 23 AM Screenshot 2024-07-05 at 10 59 20 AM

Value error from following docs

Screenshot 2024-07-05 at 11 00 34 AM Screenshot 2024-07-05 at 11 00 45 AM

Currently available leagues

FBref leagues

Fix

I think a simple updates to the docs is what's needed here unless the available leagues should include the leagues that are currently not available. I'm new to the repo but thought I'd file the issue as I go through. Happy to put up a PR updating the docs.

Originally created by @ethanfinkel on GitHub (Jul 5, 2024). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/629 Hey team, I found this issue in the docs as I was getting set up and thought I'd flag it. Awesome package by the way! The docs have instructions for pulling EPL data from FBref, but the EPL is not a valid league for FBref currently. This leads to an error when following the docs verbatim. ### Docs <img width="653" alt="Screenshot 2024-07-05 at 10 59 23 AM" src="https://github.com/probberechts/soccerdata/assets/38445051/86f6a234-6273-4f78-8edf-2c88b8d73d26"> <img width="679" alt="Screenshot 2024-07-05 at 10 59 20 AM" src="https://github.com/probberechts/soccerdata/assets/38445051/02f1a669-4fb7-4f79-bdeb-7ad5f6a5add9"> ### Value error from following docs <img width="899" alt="Screenshot 2024-07-05 at 11 00 34 AM" src="https://github.com/probberechts/soccerdata/assets/38445051/db90e9fb-081e-48b4-bb18-889c327ccb43"> <img width="691" alt="Screenshot 2024-07-05 at 11 00 45 AM" src="https://github.com/probberechts/soccerdata/assets/38445051/6fd8d248-3c9b-45b4-a773-3aacccb8c7f6"> ### Currently available leagues <img width="423" alt="FBref leagues" src="https://github.com/probberechts/soccerdata/assets/38445051/257dfefb-bcd8-4632-92e3-40eeb30e9e80"> ### Fix I think a simple updates to the docs is what's needed here unless the available leagues should include the leagues that are currently not available. I'm new to the repo but thought I'd file the issue as I go through. Happy to put up a PR updating the docs.
kerem 2026-03-02 15:55:58 +03:00
Author
Owner

@probberechts commented on GitHub (Jul 5, 2024):

Hey,

This seems to work fine on my end.

>>> import soccerdata as sd
>>> print(sd.__version__)
1.8.1

>>> sd.FBref.available_leagues()

['Big 5 European Leagues Combined',
 'ENG-Premier League',
 'ESP-La Liga',
 'FRA-Ligue 1',
 'GER-Bundesliga',
 'INT-European Championship',
 "INT-Women's World Cup",
 'INT-World Cup',
 'ITA-Serie A']

Did you perhaps edit the league_dict.json config file?

<!-- gh-comment-id:2211376560 --> @probberechts commented on GitHub (Jul 5, 2024): Hey, This seems to work fine on my end. ```py >>> import soccerdata as sd >>> print(sd.__version__) 1.8.1 >>> sd.FBref.available_leagues() ['Big 5 European Leagues Combined', 'ENG-Premier League', 'ESP-La Liga', 'FRA-Ligue 1', 'GER-Bundesliga', 'INT-European Championship', "INT-Women's World Cup", 'INT-World Cup', 'ITA-Serie A'] ``` Did you perhaps edit the `league_dict.json` config file?
Author
Owner

@ethanfinkel commented on GitHub (Jul 5, 2024):

Hey @probberechts thanks for the prompt reply.

I didn't edit any config files. Running off a fresh install. Looks like I'm on the same version you are.

Screenshot 2024-07-05 at 2 02 39 PM
<!-- gh-comment-id:2211411283 --> @ethanfinkel commented on GitHub (Jul 5, 2024): Hey @probberechts thanks for the prompt reply. I didn't edit any config files. Running off a fresh install. Looks like I'm on the same version you are. <img width="429" alt="Screenshot 2024-07-05 at 2 02 39 PM" src="https://github.com/probberechts/soccerdata/assets/38445051/8657755d-888a-41e6-a8c8-1e877c8c9109">
Author
Owner

@probberechts commented on GitHub (Jul 6, 2024):

I'm closing this since there is absolutely no way in which I can reproduce it. All tests are passing. But let me know if you would be able to figure out what's causing the issue.

<!-- gh-comment-id:2211915765 --> @probberechts commented on GitHub (Jul 6, 2024): I'm closing this since there is absolutely no way in which I can reproduce it. All tests are passing. But let me know if you would be able to figure out what's causing the issue.
Author
Owner

@babu-akhil commented on GitHub (Feb 9, 2025):

Facing the same issue.

import soccerdata as sd

fbref = sd.FBref(leagues='ENG-Premier League')
fbref.available_leagues()

gives the output


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[16], line 3
      1 import soccerdata as sd
----> 3 fbref = sd.FBref(leagues='ENG-Premier League')
      4 fbref.available_leagues()

File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\fbref.py:84, in FBref.__init__(self, leagues, seasons, proxy, no_cache, no_store, data_dir)
     72 def __init__(
     73     self,
     74     leagues: Optional[Union[str, list[str]]] = None,
   (...)
     81     data_dir: Path = FBREF_DATADIR,
     82 ):
     83     """Initialize FBref reader."""
---> 84     super().__init__(
     85         leagues=leagues,
     86         proxy=proxy,
     87         no_cache=no_cache,
     88         no_store=no_store,
     89         data_dir=data_dir,
     90     )
     91     self.rate_limit = 6
     92     self.seasons = seasons  # type: ignore

File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:497, in BaseRequestsReader.__init__(self, leagues, proxy, no_cache, no_store, data_dir)
    486 def __init__(
    487     self,
    488     leagues: Optional[Union[str, list[str]]] = None,
   (...)
    494     data_dir: Path = DATA_DIR,
    495 ):
    496     """Initialize the reader."""
--> 497     super().__init__(
    498         no_cache=no_cache,
    499         no_store=no_store,
    500         leagues=leagues,
    501         proxy=proxy,
    502         data_dir=data_dir,
    503     )
    505     self._session = self._init_session()

File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:254, in BaseReader.__init__(self, leagues, proxy, no_cache, no_store, data_dir)
    251 else:
    252     self.proxy = dict
--> 254 self._selected_leagues = leagues  # type: ignore
    255 self.no_cache = no_cache
    256 self.no_store = no_store

File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:421, in BaseReader._selected_leagues(self, ids)
    419 for i in ids:
    420     if i not in self._all_leagues():
--> 421         raise ValueError(
    422             f"""
    423             Invalid league '{i}'. Valid leagues are:
    424             {pprint.pformat(self.available_leagues())}
    425             """
    426         )
    427     tmp_league_dict[i] = self._all_leagues()[i]
    428 self._leagues_dict = tmp_league_dict

ValueError: 
                        Invalid league 'ENG-Premier League'. Valid leagues are:
                        ['Big 5 European Leagues Combined',
 'INT-European Championship',
 "INT-Women's World Cup",
 'INT-World Cup']

Issue only occurs when I'm working inside a venv. Outside venv It is working correctly!

<!-- gh-comment-id:2646215561 --> @babu-akhil commented on GitHub (Feb 9, 2025): Facing the same issue. ``` import soccerdata as sd fbref = sd.FBref(leagues='ENG-Premier League') fbref.available_leagues() ``` gives the output ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[16], line 3 1 import soccerdata as sd ----> 3 fbref = sd.FBref(leagues='ENG-Premier League') 4 fbref.available_leagues() File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\fbref.py:84, in FBref.__init__(self, leagues, seasons, proxy, no_cache, no_store, data_dir) 72 def __init__( 73 self, 74 leagues: Optional[Union[str, list[str]]] = None, (...) 81 data_dir: Path = FBREF_DATADIR, 82 ): 83 """Initialize FBref reader.""" ---> 84 super().__init__( 85 leagues=leagues, 86 proxy=proxy, 87 no_cache=no_cache, 88 no_store=no_store, 89 data_dir=data_dir, 90 ) 91 self.rate_limit = 6 92 self.seasons = seasons # type: ignore File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:497, in BaseRequestsReader.__init__(self, leagues, proxy, no_cache, no_store, data_dir) 486 def __init__( 487 self, 488 leagues: Optional[Union[str, list[str]]] = None, (...) 494 data_dir: Path = DATA_DIR, 495 ): 496 """Initialize the reader.""" --> 497 super().__init__( 498 no_cache=no_cache, 499 no_store=no_store, 500 leagues=leagues, 501 proxy=proxy, 502 data_dir=data_dir, 503 ) 505 self._session = self._init_session() File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:254, in BaseReader.__init__(self, leagues, proxy, no_cache, no_store, data_dir) 251 else: 252 self.proxy = dict --> 254 self._selected_leagues = leagues # type: ignore 255 self.no_cache = no_cache 256 self.no_store = no_store File c:\Users\akhil\Work\footy\venv\Lib\site-packages\soccerdata\_common.py:421, in BaseReader._selected_leagues(self, ids) 419 for i in ids: 420 if i not in self._all_leagues(): --> 421 raise ValueError( 422 f""" 423 Invalid league '{i}'. Valid leagues are: 424 {pprint.pformat(self.available_leagues())} 425 """ 426 ) 427 tmp_league_dict[i] = self._all_leagues()[i] 428 self._leagues_dict = tmp_league_dict ValueError: Invalid league 'ENG-Premier League'. Valid leagues are: ['Big 5 European Leagues Combined', 'INT-European Championship', "INT-Women's World Cup", 'INT-World Cup'] ``` Issue only occurs when I'm working inside a venv. Outside venv It is working correctly!
Author
Owner

@babu-akhil commented on GitHub (Feb 9, 2025):

Its working now after I restart kernel. No code change in package. Very Strange!

<!-- gh-comment-id:2646235864 --> @babu-akhil commented on GitHub (Feb 9, 2025): Its working now after I restart kernel. No code change in package. Very Strange!
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#123
No description provided.