the importlib stuff broke early versions of py2.7
This commit is contained in:
ed 2025-07-30 21:07:47 +00:00
parent 4f1eb89382
commit b7ca6f4a66

View file

@ -4186,7 +4186,14 @@ def load_resource(E: EnvParams, name: str, mode="rb") -> IO[bytes]:
stream = codecs.getreader(enc)(stream) stream = codecs.getreader(enc)(stream)
return stream return stream
return open(os.path.join(E.mod, name), mode, encoding=enc) ap = os.path.join(E.mod, name)
if PY2:
import codecs
return codecs.open(ap, "r", encoding=enc) # type: ignore
return open(ap, mode, encoding=enc)
class Pebkac(Exception): class Pebkac(Exception):