oracle / graalpython

A high-performance embeddable Python 3 runtime for Java
https://www.graalvm.org/python/
Other
1.22k stars 104 forks source link

Using the maven plugin with the default VirtualFileSystem leads to pathlib.Path.exists not working #403

Open timfel opened 3 months ago

timfel commented 3 months ago

This can be observed when using pyfiglet with the maven plugin. The code of pyfiglet has this

path = importlib.resources.files('pyfiglet.fonts').joinpath(fn)
if path.exists():
    ...

path.exists() uses a stat call, and we raise (correctly) OSError for non-existing paths. But pathlib checks that the errno of that error is in a list of allowed errors, and otherwise just throws the exception upwards. The OSError raised from the VirtualFileSystem is errno 5: EIO, it should probably be errno 2: ENOENT.