From 4fb1982a5fbe7e5f947fa9ebe24125a6d966d240 Mon Sep 17 00:00:00 2001 From: Danyal-Faheem Date: Wed, 16 Oct 2024 20:48:29 +0500 Subject: [PATCH] fix: use __package__ in importlib_resources for compatibility with sumac --- openedxscorm/scormxblock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openedxscorm/scormxblock.py b/openedxscorm/scormxblock.py index d7af224..e2116b0 100644 --- a/openedxscorm/scormxblock.py +++ b/openedxscorm/scormxblock.py @@ -200,7 +200,10 @@ def initialize_student_info(self): @staticmethod def resource_string(path): """Handy helper for getting static resources from our kit.""" - data = importlib_resources.files(__name__).joinpath(path).read_bytes() + try: + data = importlib_resources.files(__name__).joinpath(path).read_bytes() + except TypeError: + data = importlib_resources.files(__package__).joinpath(path).read_bytes() return data.decode("utf8") def author_view(self, context=None):