Skip to content

[5.2.0] importlib_resources.path does not throw FileNotFoundError anymore #230

Description

@chaen

Hi,
the release 5.2.0 introduced quite a big change, and I am not sure it was expected/wanted.

Consider this simple file

importimportlib_resourcesimportlib_resources.path('attr', 'toto.py')
print("OK")

Obviously, toto.py does not exist.

With 5.1.4, we get

Traceback (most recent call last): File "/tmp/test_import.py", line 2, in <module> importlib_resources.path('attr', 'toto.py') File "/home/chaen/miniconda2/envs/test-env-debug/lib/python3.9/site-packages/importlib_resources/_py3.py", line 104, in path _path_from_reader(reader, _common.normalize_path(resource)) File "/home/chaen/miniconda2/envs/test-env-debug/lib/python3.9/site-packages/importlib_resources/_py3.py", line 113, in _path_from_reader return _path_from_resource_path(reader, resource) or _path_from_open_resource( File "/home/chaen/miniconda2/envs/test-env-debug/lib/python3.9/site-packages/importlib_resources/_py3.py", line 124, in _path_from_open_resource saved = io.BytesIO(reader.open_resource(resource).read()) File "<frozen importlib._bootstrap_external>", line 1060, in open_resource FileNotFoundError: [Errno 2] No such file or directory: '/home/chaen/miniconda2/envs/test-env-debug/lib/python3.9/site-packages/attr/toto.py' 

While with 5.2.0, it just goes through.

Is that a desired change ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions