Skip to content

Commit

Permalink
Fixed path to use package for compatibility with older versions (#42)
Browse files Browse the repository at this point in the history
Co-authored-by: Abdul Manan <[email protected]>
  • Loading branch information
manan-memon and abdulmanann authored Oct 1, 2024
1 parent bd08913 commit 2d2a985
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion h5pxblock/h5pxblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 2d2a985

Please sign in to comment.