Skip to content

Possible bug introduced with PR250, joinpath with "." causes StopIteration #263

@VolkerH

Description

@VolkerH

Consider the following code snippet:

stopiteration_bug.py:

import spacem_maldi.Ontologies
from importlib_resources import files


print(files(spacem_maldi.Ontologies) / ".")

With importlib-resources<=5.7.1 this produces the following output:

/home/hilsenst/GitlabEMBL/spacem-ht/src/spacem-maldi/spacem_maldi/Ontologies

Starting from version 5.8.0, i.e. after PR #250 this throws a StopIteration exception:

~/Untracked$ python stopiteration_bug.py 
Traceback (most recent call last):
  File "stopiteration_bug.py", line 5, in <module>
    print(files(spacem_maldi.Ontologies) / ".")
  File "/home/hilsenst/miniconda3/envs/spacem-maldi-control/lib/python3.8/site-packages/importlib_resources/abc.py", line 130, in __truediv__
    return self.joinpath(child)
  File "/home/hilsenst/miniconda3/envs/spacem-maldi-control/lib/python3.8/site-packages/importlib_resources/readers.py", line 87, in joinpath
    return super().joinpath(*descendants)
  File "/home/hilsenst/miniconda3/envs/spacem-maldi-control/lib/python3.8/site-packages/importlib_resources/abc.py", line 114, in joinpath
    target = next(names)
StopIteration

The spacem_maldi package is a private package, but I don't think that is relevant here. If needed I can try and create a minimal public package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions