You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
importlib.abc.Traversable.name does not match #89896
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-11-06.01:23:27.490>labels= ['type-bug', '3.9', '3.10', '3.11']
title='importlib.abc.Traversable.name does not match'updated_at=<Date2021-11-06.01:23:27.490>user='https://bugs.python.org/jmg'
The issue is that with Python 3.9.7 (default, Nov 1 2021, 11:26:33), using a standard posix module (on MacOSX), it returns a string and not a method. I have not tested on newer versions, but expect similar issues. I have tagged the newer versions to get exposure, feel free to untag the versions that are confirmed to be unaffected by this bug.
$ python3.9
Python 3.9.7 (default, Nov 1 2021, 11:26:33)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod
<class 'str'>
>>> ^D
This is with a module dir named mod, w/ an empty res.txt file, and the following in __init__.py:
from importlib import resources
r = resources.files(__name__) / 'res.txt'
print(repr(type(r.name)))
Activity
jmg commentedon Nov 6, 2021
The documentation for Traversable.name says it is a method, not a property:
https://docs.python.org/3/library/importlib.html#importlib.abc.Traversable.name
The issue is that with Python 3.9.7 (default, Nov 1 2021, 11:26:33), using a standard posix module (on MacOSX), it returns a string and not a method. I have not tested on newer versions, but expect similar issues. I have tagged the newer versions to get exposure, feel free to untag the versions that are confirmed to be unaffected by this bug.
This is with a module dir named
mod, w/ an emptyres.txtfile, and the following in__init__.py:warsaw commentedon Jun 10, 2022
Yikes! I just ran into this too. I'll test it on newer versions and submit a PR. Should be an easy documentation fix.
warsaw commentedon Jun 10, 2022
Well, not so easy apparently because of the
importlibdocs got reorg'd inmain, so it'll take a couple of PRs most likely.warsaw commentedon Jun 10, 2022
Turns out, this is fixed in
mainbut there's another problem (#93610) for which I created a PR first.`importlib.abc.Traversable.name` is an attribute, not a method
pythongh-89896: `importlib.abc.Traversable.name` is an attribute, not…
jaraco commentedon Nov 26, 2022
Looks like this work was done. Thanks warsaw and jmg. Please comment or re-open if the issue remains.