From e6633c1e7efed6839caff28219f9a86a04f9220b Mon Sep 17 00:00:00 2001 From: Ahmed Khalid <106074266+ahmed-arb@users.noreply.github.com> Date: Thu, 14 Mar 2024 10:42:22 +0500 Subject: [PATCH 1/2] fix: remove pkg_resources for compatibility with python 3.12 --- openedxscorm/scormxblock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedxscorm/scormxblock.py b/openedxscorm/scormxblock.py index 5075c09..ce91d2c 100644 --- a/openedxscorm/scormxblock.py +++ b/openedxscorm/scormxblock.py @@ -15,7 +15,7 @@ from django.utils import timezone from django.utils.module_loading import import_string from webob import Response -import pkg_resources +import importlib_resources from six import string_types from web_fragments.fragment import Fragment @@ -183,7 +183,7 @@ def get_current_user(self): @staticmethod def resource_string(path): """Handy helper for getting static resources from our kit.""" - data = pkg_resources.resource_string(__name__, path) + data = importlib_resources.files(__package__).joinpath(path).read_bytes() return data.decode("utf8") def author_view(self, context=None): From f0156f069f8a3c1c8ae1c2f037c78c9222d9bb6b Mon Sep 17 00:00:00 2001 From: Ahmed Khalid <106074266+ahmed-arb@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:28:47 +0500 Subject: [PATCH 2/2] fix: update recourse string with module name --- openedxscorm/scormxblock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedxscorm/scormxblock.py b/openedxscorm/scormxblock.py index ce91d2c..b7af42f 100644 --- a/openedxscorm/scormxblock.py +++ b/openedxscorm/scormxblock.py @@ -183,7 +183,7 @@ def get_current_user(self): @staticmethod def resource_string(path): """Handy helper for getting static resources from our kit.""" - data = importlib_resources.files(__package__).joinpath(path).read_bytes() + data = importlib_resources.files(__name__).joinpath(path).read_bytes() return data.decode("utf8") def author_view(self, context=None):