[issue25330] Docs for pkgutil.get_data inconsistent with semantics
Paul Ganssle
report at bugs.python.org
Fri Jan 26 12:15:18 EST 2018
Paul Ganssle <p.ganssle at gmail.com> added the comment:
I'm not sure if this warrants a separate issue, but I also notice this in the documentation:
> If the package cannot be located or loaded, or it uses a loader which does not support get_data, then None is returned. In particular, the loader for namespace packages does not support get_data.
But in reality this seems to raise a FileNotFoundError:
>>> import pkgutil
>>> data = pkgutil.get_data('dateutil.zoneinfo', 'dateutil-zoneinfo.tar.gz')
>>> len(data)
139671
>>> data = pkgutil.get_data('dateutil.zoneinfo', 'foo-bar.tar.gz')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3.6/site-packages/dateutil/zoneinfo/foo-bar.tar.gz'
Am I misunderstanding the documentation, or should the failure mode be corrected to specify that it raises an error?
----------
nosy: +p-ganssle
versions: +Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue25330>
_______________________________________
More information about the Python-bugs-list
mailing list