From 72bbcab7dbc5be1c937c80825a7f1f73cdc7decc Mon Sep 17 00:00:00 2001 From: cosven Date: Wed, 6 Nov 2024 17:39:23 +0800 Subject: [PATCH] server: fix crash when any webserver dependency is not installed --- feeluown/app/server_app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/feeluown/app/server_app.py b/feeluown/app/server_app.py index 858cdbf685..d815f5ac7f 100644 --- a/feeluown/app/server_app.py +++ b/feeluown/app/server_app.py @@ -52,7 +52,11 @@ def run(self): self.config.PUBSUB_PORT, )) if self.config.ENABLE_WEB_SERVER: - from feeluown.webserver import run_web_server - asyncio.create_task( - run_web_server(self.get_listen_addr(), self.config.WEB_PORT)) + try: + from feeluown.webserver import run_web_server + except ImportError as e: + logger.error(f"can't enable webserver, err: {e}") + else: + asyncio.create_task( + run_web_server(self.get_listen_addr(), self.config.WEB_PORT)) asyncio.create_task(run_nowplaying_server(self))