[GH-ISSUE #601] Cannot retrieve data from Custom League #110

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

Originally created by @pranavm28 on GitHub (May 30, 2024).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/601

ValueError:
Invalid league 'ARG-Liga Profesional'. Valid leagues are:
['ENG-Premier League',
'ESP-La Liga',
'FRA-Ligue 1',
'GER-Bundesliga',
"INT-Women's World Cup",
'INT-World Cup',
'ITA-Serie A']

This is the error that I am getting. It's the same even if I try to scrape for the Brazilian league or the Portuguese league.

Here is my league_dict:
|
LEAGUE_DICT = {
"ENG-Premier League": {
"ClubElo": "ENG_1",
"MatchHistory": "E0",
"FiveThirtyEight": "premier-league",
"FBref": "Premier League",
"ESPN": "eng.1",
"SoFIFA": "[England] Premier League",
"WhoScored": "England - Premier League",
"season_start": "Aug",
"season_end": "May",
},
"ESP-La Liga": {
"ClubElo": "ESP_1",
"MatchHistory": "SP1",
"FiveThirtyEight": "la-liga",
"FBref": "La Liga",
"ESPN": "esp.1",
"SoFIFA": "[Spain] La Liga",
"WhoScored": "Spain - LaLiga",
"season_start": "Aug",
"season_end": "May",
},
"ITA-Serie A": {
"ClubElo": "ITA_1",
"MatchHistory": "I1",
"FiveThirtyEight": "serie-a",
"FBref": "Serie A",
"ESPN": "ita.1",
"SoFIFA": "[Italy] Serie A",
"WhoScored": "Italy - Serie A",
"season_start": "Aug",
"season_end": "May",
},
"GER-Bundesliga": {
"ClubElo": "GER_1",
"MatchHistory": "D1",
"FiveThirtyEight": "bundesliga",
"FBref": "Fußball-Bundesliga",
"ESPN": "ger.1",
"SoFIFA": "[Germany] Bundesliga",
"WhoScored": "Germany - Bundesliga",
"season_start": "Aug",
"season_end": "May",
},
"FRA-Ligue 1": {
"ClubElo": "FRA_1",
"MatchHistory": "F1",
"FiveThirtyEight": "ligue-1",
"FBref": "Ligue 1",
"ESPN": "fra.1",
"SoFIFA": "[France] Ligue 1",
"WhoScored": "France - Ligue 1",
"season_start": "Aug",
"season_end": "May",
},
"INT-World Cup": {
"FBref": "FIFA World Cup",
"WhoScored": "International - FIFA World Cup",
},
"ARG-Liga Profesional": {
"WhoScored":"Argentina - Liga Profesional"
},
"BRA-Brasileirao": {
"WhoScored":"Brazil - Brasileirão",
"season_start": "Apr",
"season_end": "Dec",
},
"POR-Liga Portugal": {
"WhoScored":"Portugal - Liga Portugal",
"season_start": "Aug",
"season_end": "May",
}

}

Seems like any new league that I am adding to the dictionary isn't being read. Or maybe I am making a huge mistake somewhere.
Please help me in resolving this and thanks in advance!

Originally created by @pranavm28 on GitHub (May 30, 2024). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/601 ValueError: Invalid league 'ARG-Liga Profesional'. Valid leagues are: ['ENG-Premier League', 'ESP-La Liga', 'FRA-Ligue 1', 'GER-Bundesliga', "INT-Women's World Cup", 'INT-World Cup', 'ITA-Serie A'] This is the error that I am getting. It's the same even if I try to scrape for the Brazilian league or the Portuguese league. Here is my league_dict: | LEAGUE_DICT = { "ENG-Premier League": { "ClubElo": "ENG_1", "MatchHistory": "E0", "FiveThirtyEight": "premier-league", "FBref": "Premier League", "ESPN": "eng.1", "SoFIFA": "[England] Premier League", "WhoScored": "England - Premier League", "season_start": "Aug", "season_end": "May", }, "ESP-La Liga": { "ClubElo": "ESP_1", "MatchHistory": "SP1", "FiveThirtyEight": "la-liga", "FBref": "La Liga", "ESPN": "esp.1", "SoFIFA": "[Spain] La Liga", "WhoScored": "Spain - LaLiga", "season_start": "Aug", "season_end": "May", }, "ITA-Serie A": { "ClubElo": "ITA_1", "MatchHistory": "I1", "FiveThirtyEight": "serie-a", "FBref": "Serie A", "ESPN": "ita.1", "SoFIFA": "[Italy] Serie A", "WhoScored": "Italy - Serie A", "season_start": "Aug", "season_end": "May", }, "GER-Bundesliga": { "ClubElo": "GER_1", "MatchHistory": "D1", "FiveThirtyEight": "bundesliga", "FBref": "Fußball-Bundesliga", "ESPN": "ger.1", "SoFIFA": "[Germany] Bundesliga", "WhoScored": "Germany - Bundesliga", "season_start": "Aug", "season_end": "May", }, "FRA-Ligue 1": { "ClubElo": "FRA_1", "MatchHistory": "F1", "FiveThirtyEight": "ligue-1", "FBref": "Ligue 1", "ESPN": "fra.1", "SoFIFA": "[France] Ligue 1", "WhoScored": "France - Ligue 1", "season_start": "Aug", "season_end": "May", }, "INT-World Cup": { "FBref": "FIFA World Cup", "WhoScored": "International - FIFA World Cup", }, "ARG-Liga Profesional": { "WhoScored":"Argentina - Liga Profesional" }, "BRA-Brasileirao": { "WhoScored":"Brazil - Brasileirão", "season_start": "Apr", "season_end": "Dec", }, "POR-Liga Portugal": { "WhoScored":"Portugal - Liga Portugal", "season_start": "Aug", "season_end": "May", } } Seems like any new league that I am adding to the dictionary isn't being read. Or maybe I am making a huge mistake somewhere. Please help me in resolving this and thanks in advance!
kerem 2026-03-02 15:55:52 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@probberechts commented on GitHub (May 30, 2024):

  1. Make sure to reload the soccerdata module after you modify the league_dict.json file. This file is parsed during the module's import.
  2. Check whether your league_dict.json file is at the correct location. If so, you should see this appear in the log messages.
$python
>>> import soccerdata as sd
[11/25/22 11:49:12] INFO     Custom team name replacements loaded from <path>/teamname_replacements.json.                                                                                                _config.py:83
                    INFO     Custom league dict loaded from <path>/league_dict.json.                                                                                                                    _config.py:153
  1. Check whether it is added to available leagues by running the command below.
>>> sd.WhoScored.available_leagues()
[ 'ENG-Premier League', 'ESP-La Liga', 'FRA-Ligue 1', 'GER-Bundesliga', 'INT-World Cup', 'ITA-Serie A']

If that doesn't work, you probably made a mistake in the syntax of your league_dict.json file

<!-- gh-comment-id:2139149853 --> @probberechts commented on GitHub (May 30, 2024): 1. Make sure to reload the soccerdata module after you modify the `league_dict.json` file. This file is parsed during the module's import. 2. Check whether your `league_dict.json` file is at the correct location. If so, you should see this appear in the log messages. ```sh $python >>> import soccerdata as sd [11/25/22 11:49:12] INFO Custom team name replacements loaded from <path>/teamname_replacements.json. _config.py:83 INFO Custom league dict loaded from <path>/league_dict.json. _config.py:153 ``` 3. Check whether it is added to available leagues by running the command below. ``` >>> sd.WhoScored.available_leagues() [ 'ENG-Premier League', 'ESP-La Liga', 'FRA-Ligue 1', 'GER-Bundesliga', 'INT-World Cup', 'ITA-Serie A'] ``` If that doesn't work, you probably made a mistake in the syntax of your `league_dict.json` file
Author
Owner

@pranavm28 commented on GitHub (May 30, 2024):

Fixed! Thanks a lot, Rob!

<!-- gh-comment-id:2139519504 --> @pranavm28 commented on GitHub (May 30, 2024): Fixed! Thanks a lot, Rob!
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#110
No description provided.