From 8684c7a028b65381ec6c6724e2f9c9bea7df0aee Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 11 Sep 2024 22:27:33 -0400 Subject: [PATCH] Add workaround for broken importlib.resources when an editable sentinel is present. Closes #318 --- importlib_resources/future/adapters.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/importlib_resources/future/adapters.py b/importlib_resources/future/adapters.py index 0e9764b..5cf1755 100644 --- a/importlib_resources/future/adapters.py +++ b/importlib_resources/future/adapters.py @@ -23,6 +23,13 @@ def wrapper(*args, **kwargs): except NotADirectoryError: # MultiplexedPath may fail on zip subdirectory return + except ValueError as exc: + # NamespaceReader in stdlib may fail for editable installs + # (python/importlib_resources#311, python/importlib_resources#318) + # Remove after bugfix applied to Python 3.13. + if "not enough values to unpack" not in str(exc): + raise + return # Python 3.10+ mod_name = reader.__class__.__module__ if mod_name.startswith('importlib.') and mod_name.endswith('readers'):