From 6a286a4c23c293fdb491b67f943e142bbd08ede2 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Tue, 2 Aug 2022 00:21:04 +0100 Subject: [PATCH] Remove second serve dependencies check The second one isnt needed so long as the YAML import is 2nd. Once it tries to import serve it will fail and it's ImportError will get handled. --- pywidevine/main.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pywidevine/main.py b/pywidevine/main.py index 75be077..cfbc24d 100644 --- a/pywidevine/main.py +++ b/pywidevine/main.py @@ -1,5 +1,4 @@ import logging -import sys from datetime import datetime from pathlib import Path from typing import Optional @@ -299,16 +298,8 @@ def serve_(config: Path, host: str, port: int): Host as 127.0.0.1 may block remote access even if port-forwarded. Instead, use 0.0.0.0 and ensure the TCP port you choose is forwarded. """ - try: - import yaml - from pywidevine import serve - except ImportError: - print( - "Missing the extra dependencies for serve functionality. " - "You may install them under poetry with `poetry install -E serve`, " - "or under pip with `pip install pywidevine[serve]`." - ) - sys.exit(1) + from pywidevine import serve + import yaml config = yaml.safe_load(config.read_text(encoding="utf8")) serve.run(config, host, port)