-
-
Notifications
You must be signed in to change notification settings - Fork 49
Description
This happens to me when I try to access resources in a native namespace package.
Tested on:
- Windows,
Python 3.10.4 - Docker in WSL2, image
python:3.10-slim,Python 3.10.5
The reason seems to be that importlib_resources.files() returns MultiplexedPath from stdlib (importlib.readers) rather than from importlib_resources.readers.
To recreate:
-
Install any namespace package, e.g.
sphinxcontrib-htmlhelp;pip install sphinxcontrib-htmlhelp -
Use
fileswithjoinpathto get the path of a resource.from importlib_resources import files print(root:=files('sphinxcontrib'), 'from', root.__module__) print(root.joinpath('htmlhelp', 'templates'))
Expected output (which I get with Pythons 3.7-3.9):
MultiplexedPath('/usr/local/lib/python3.9/site-packages/sphinxcontrib') from importlib_resources.readers
/usr/local/lib/python3.9/site-packages/sphinxcontrib/htmlhelp/templates
Bug with Pythons 3.10:
MultiplexedPath('/usr/local/lib/python3.10/site-packages/sphinxcontrib') from importlib.readers
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: MultiplexedPath.joinpath() takes 2 positional arguments but 3 were given
I also tested with the code in #254 but to no aval.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels