From 6c65c2ad568a4cbeeab6bc6b863465151d687e02 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Thu, 23 Jun 2022 13:05:27 -0700 Subject: [PATCH] Make importlib usage compatible with python 3.9 --- comictaggerlib/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/comictaggerlib/main.py b/comictaggerlib/main.py index 517e1b7..d35fed1 100755 --- a/comictaggerlib/main.py +++ b/comictaggerlib/main.py @@ -15,7 +15,6 @@ # limitations under the License. from __future__ import annotations -import importlib.metadata import json import logging.handlers import os @@ -33,6 +32,11 @@ from comictaggerlib.ctversion import version from comictaggerlib.options import parse_cmd_line from comictaggerlib.settings import ComicTaggerSettings +if sys.version_info < (3, 10): + import importlib_metadata +else: + import importlib.metadata as importlib_metadata + logger = logging.getLogger("comictagger") logging.getLogger("comicapi").setLevel(logging.DEBUG) logging.getLogger("comictaggerlib").setLevel(logging.DEBUG) @@ -154,7 +158,7 @@ def ctmain() -> None: ) logger.debug("Installed Packages") - for pkg in sorted(importlib.metadata.distributions(), key=lambda x: x.name): + for pkg in sorted(importlib_metadata.distributions(), key=lambda x: x.name): logger.debug("%s\t%s", pkg.name, pkg.version) utils.load_publishers()