From b7ca6f4a66202ced70ebd87df169aebb41ebb81d Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 30 Jul 2025 21:07:47 +0000 Subject: [PATCH] try to fix #300 the importlib stuff broke early versions of py2.7 --- copyparty/util.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/copyparty/util.py b/copyparty/util.py index ae968777..4e5cbfbe 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -4186,7 +4186,14 @@ def load_resource(E: EnvParams, name: str, mode="rb") -> IO[bytes]: stream = codecs.getreader(enc)(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):