From 81ae99ff42adf53e06a9650c0eec6e4ef8ffaa5c Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Thu, 26 Mar 2026 19:47:18 -0300 Subject: [PATCH] Handle missing 'librespot' extra --- votify/cli/cli.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/votify/cli/cli.py b/votify/cli/cli.py index a6afed8..890db4d 100644 --- a/votify/cli/cli.py +++ b/votify/cli/cli.py @@ -93,10 +93,20 @@ async def main(config: CliConfig): database = None flat_filter = None - api = await SpotifyApi.create_from_netscape_cookies( - cookies_path, - session_type=config.session_type, - ) + try: + api = await SpotifyApi.create_from_netscape_cookies( + cookies_path, + session_type=config.session_type, + ) + except ModuleNotFoundError as e: + if e.name == "librespot": + logger.critical( + "The 'librespot' extra is required to use the librespot session type, " + "please install the package with `pip install votify[librespot]` and try again" + ) + return + raise e + if api.anonymous_session: logger.critical( "Could not authenticate with the provided cookies, "