[docs] [issue35843] importlib.util docs for namespace packages innaccurate

Anthony Sottile report at bugs.python.org
Mon Jan 28 13:07:30 EST 2019


Anthony Sottile <asottile at umich.edu> added the comment:

Hmmm, it appears this was changed in python3.7 to have `None` for the origin instead of `'namespace'` -- however the `submodule_search_locations` is still not indexable:



>>> importlib.util.find_spec('a')
ModuleSpec(name='a', loader=None, submodule_search_locations=_NamespacePath(['/tmp/x/a']))
>>> importlib.util.find_spec('a').origin
>>> spec = importlib.util.find_spec('a')
>>> spec.submodule_search_locations
_NamespacePath(['/tmp/x/a'])
>>> spec.submodule_search_locations[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '_NamespacePath' object does not support indexing

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35843>
_______________________________________


More information about the docs mailing list