From 5cc106f125f82b7f0677f716cc6d0628c52243c0 Mon Sep 17 00:00:00 2001 From: Abdul Manan Date: Mon, 30 Sep 2024 20:04:38 +0500 Subject: [PATCH] Fixed path to use package for compatibility with older versions --- h5pxblock/h5pxblock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/h5pxblock/h5pxblock.py b/h5pxblock/h5pxblock.py index 22c868b5..79f2c1cc 100644 --- a/h5pxblock/h5pxblock.py +++ b/h5pxblock/h5pxblock.py @@ -183,7 +183,10 @@ class H5PPlayerXBlock(XBlock, CompletableXBlockMixin): def resource_string(self, path): """Handy helper for getting 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 render_template(self, template_path, context):