Skip to content

Commit

Permalink
Fix importlib.resources call for Python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiner authored and Heinrich Kuttler committed May 4, 2024
1 parent 4db6f42 commit 5e22a93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nle/nethack/nethack.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@
"time",
)

HACKDIR = str(importlib.resources.files("nle") / "nethackdir")
try:
HACKDIR = str(importlib.resources.files("nle") / "nethackdir")
except AttributeError: # No files() function in Python 3.8.
with importlib.resources.path("nle", "nethackdir") as path:
HACKDIR = str(path)

TTYREC_VERSION = 3


Expand Down

0 comments on commit 5e22a93

Please sign in to comment.