Matt Wozniski <godlyg...@gmail.com> added the comment:

I wondered if it would be backwards compatible to make `pkgutil.get_data()` 
delegate to `importlib.resources.read_binary()`. It isn't, because 
`pkgutil.get_data()` accepts a relative path for the resource, and 
`importlib.resources.read_binary()` accepts only a filename. That is, you can 
do:

    pkgutil.get_data(__name__, "subdir/some_file")

but not:

    importlib.resources.read_binary(__name__, "subdir/some_file")

The latter fails with:

      File "/opt/bb/lib/python3.10/importlib/_common.py", line 34, in 
normalize_path
        raise ValueError(f'{path!r} must be only a file name')

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45675>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to