mirror of
https://github.com/probberechts/soccerdata.git
synced 2026-04-25 10:05:53 +03:00
[GH-ISSUE #739] [FBref] team_match_stats for teams with slash "/" in the name results in FileNotFoundError #159
Labels
No labels
ESPN
FBref
FotMob
MatchHistory
SoFIFA
Sofascore
WhoScored
WhoScored
bug
build
common
dependencies
discussion
documentation
duplicate
enhancement
good first issue
invalid
performance
pull-request
question
question
removal
understat
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/soccerdata#159
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ilyacherevkov on GitHub (Oct 30, 2024).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/739
Describe the bug
Unable to use team_match_stats for teams with slash in the name, like Bodø/Glimt.
It tries to create file matchlogs_Bodø/Glimt_2022_schedule.html, which resolves incorrectly due to slash in the name.
Affected scrapers
This affects the following scrapers:
Code example
A minimal code example that fails. Use
no_cache=Trueto make sure an invalid cached file does not cause the bug and make sure you have the latest version of soccerdata installed.Error message
Additional context
Note, line number in _common.py with the error might differ, as I did minor changes in the code.
Contributor Action Plan
@ilyacherevkov commented on GitHub (Oct 30, 2024):
Fixed it by changing in fbref.py
filepath = self.data_dir / filemask.format(team, skey, stat_type)to
filepath = self.data_dir / filemask.format(team.replace('/',''), skey, stat_type)Not sure if it breaks anything, though.
@probberechts commented on GitHub (Oct 30, 2024):
No, it won't break anything. A more generic solution would be to use something like Django's
slugify()function.