From 2ab2573946198553f1d8b5b4179af6d41aec2a3d Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Thu, 27 Feb 2025 20:15:32 +0100 Subject: [PATCH] Enable execution in Docker environments --- html2print/html2print.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/html2print/html2print.py b/html2print/html2print.py index af6f006..7493cd4 100644 --- a/html2print/html2print.py +++ b/html2print/html2print.py @@ -39,6 +39,14 @@ class ChromeDriverManager: def get_chrome_driver(self, path_to_cache_dir: str): chrome_version = self.get_chrome_version() + + # If Web Driver Manager cannot detect Chrome, it returns None. + if chrome_version is None: + raise RuntimeError( + "html2print: " + "Web Driver Manager could not detect an existing Chrome installation." + ) + chrome_major_version = chrome_version.split(".")[0] print( # noqa: T201