From 1452ddd5e49c2a2e9de92d3aad9e16699d7fa7f9 Mon Sep 17 00:00:00 2001 From: Safihre Date: Fri, 21 Aug 2020 15:20:13 +0200 Subject: [PATCH] Do not crash if certifi certificates are not available This could happen on Windows, due to overactive virus scanners --- SABnzbd.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/SABnzbd.py b/SABnzbd.py index eb94f06..dada571 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1179,9 +1179,14 @@ def main(): if importlib.util.find_spec("certifi") is not None: import certifi - os.environ["SSL_CERT_FILE"] = certifi.where() - logging.info("Certifi version: %s", certifi.__version__) - logging.info("Loaded additional certificates from: %s", os.environ["SSL_CERT_FILE"]) + try: + os.environ["SSL_CERT_FILE"] = certifi.where() + logging.info("Certifi version: %s", certifi.__version__) + logging.info("Loaded additional certificates from: %s", os.environ["SSL_CERT_FILE"]) + except: + # Sometimes the certificate file is blocked + logging.warning(T("Could not load additional certificates from certifi package")) + logging.info("Traceback: ", exc_info=True) # Extra startup info if sabnzbd.cfg.log_level() > 1: