From 6ab6343ae7ce39583d08eb6200fb0fc71605e295 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Mon, 29 Jan 2024 04:26:54 -0500 Subject: [PATCH] fix ImportError on python 3.8 --- relay/database/__init__.py | 8 ++++++-- requirements.txt | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/relay/database/__init__.py b/relay/database/__init__.py index 8e79200..c403092 100644 --- a/relay/database/__init__.py +++ b/relay/database/__init__.py @@ -3,14 +3,18 @@ from __future__ import annotations import tinysql import typing -from importlib.resources import files as pkgfiles - from .config import get_default_value from .connection import Connection from .schema import VERSIONS, migrate_0 from .. import logger as logging +try: + from importlib.resources import files as pkgfiles + +except ImportError: + from importlib_resources import files as pkgfiles + if typing.TYPE_CHECKING: from .config import Config diff --git a/requirements.txt b/requirements.txt index 43ebfe4..43bea12 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,5 @@ cachetools>=5.2.0 click>=8.1.2 pyyaml>=6.0 tinysql@https://git.barkshark.xyz/barkshark/tinysql/archive/0.2.2a.tar.gz + +importlib_resources==6.1.1;python_version<'3.9'