Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ff1.get_session not working #625

Open
lalutir opened this issue Jul 28, 2024 · 3 comments
Open

[BUG] ff1.get_session not working #625

lalutir opened this issue Jul 28, 2024 · 3 comments
Labels
stale No activity in a long time

Comments

@lalutir
Copy link

lalutir commented Jul 28, 2024

Describe the issue:

I tried loading data using the get_session function, however, it gives me an error saying failed to load any schedule data.

Reproduce the code example:

fp1 = ff1.get_session(2021, 1, 'FP1')

Error message:

logger      WARNING 	Failed to load schedule from FastF1 backend!
req            INFO 	No cached data found for season_schedule. Loading data...
_api           INFO 	Fetching season schedule...
logger      WARNING 	Failed to load schedule from F1 API backend!
logger      WARNING 	Failed to load schedule from Ergast API backend!

{
	"name": "ValueError",
	"message": "Failed to load any schedule data.",
	"stack": "---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[35], line 1
----> 1 fp1 = ff1.get_session(2021, 1, 'FP1')

File c:\\Users\\larsl\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\fastf1\\events.py:308, in get_session(year, gp, identifier, backend, force_ergast)
    240 def get_session(
    241         year: int,
    242         gp: Union[str, int],
   (...)
    246         force_ergast: bool = False,
    247 ) -> Session:
    248     \"\"\"Create a :class:`~fastf1.core.Session` object based on year, event name
    249     and session identifier.
    250 
   (...)
    306             from the ergast database to create the event schedule
    307     \"\"\"
--> 308     event = get_event(year, gp, force_ergast=force_ergast, backend=backend)
    309     return event.get_session(identifier)

File c:\\Users\\larsl\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\fastf1\\events.py:403, in get_event(year, gp, backend, force_ergast, strict_search, exact_match)
    348 def get_event(
    349         year: int,
    350         gp: Union[int, str],
   (...)
    355         exact_match: bool = False
    356 ) -> \"Event\":
    357     \"\"\"Create an :class:`~fastf1.events.Event` object for a specific
    358     season and gp.
    359 
   (...)
    401     .. versionadded:: 2.2
    402     \"\"\"
--> 403     schedule = get_event_schedule(year=year, include_testing=False,
    404                                   force_ergast=force_ergast,
    405                                   backend=backend)
    407     if isinstance(gp, str):
    408         event = schedule.get_event_by_name(
    409             gp, strict_search=strict_search, exact_match=exact_match)

File c:\\Users\\larsl\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\fastf1\\events.py:520, in get_event_schedule(year, include_testing, backend, force_ergast)
    517         break
    519 if schedule is None:  # raise Error if fallback failed as well
--> 520     raise ValueError(\"Failed to load any schedule data.\")
    522 if not include_testing:
    523     schedule = schedule[~schedule.is_testing()]

ValueError: Failed to load any schedule data."
}
@theOehrly
Copy link
Owner

I think that clearing the content of your FastF1 cache directory should fix the problem.
Apart from that, have you updated to the latest version?

@lalutir
Copy link
Author

lalutir commented Jul 28, 2024

I already cleared the cache (just deleted the files, found out later there's a function for it) and I am updated to the latest version.

@theOehrly
Copy link
Owner

Interesting. Can you post the output with log level set to "DEBUG"?

See https://docs.fastf1.dev/fastf1.html#fastf1.set_log_level

@theOehrly theOehrly added the stale No activity in a long time label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale No activity in a long time
Projects
None yet
Development

No branches or pull requests

2 participants