New submission from Zac Hatfield-Dodds <zac.hatfield.do...@gmail.com>:
Testing Hypothesis with Python 3.11.0a3, I've triggered a frustrating regression in importlib.resources: # Both work in Python 3.9 and 3.10, but both fail in 3.11.0a3 from importlib.resources import files, read_text read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt") files("hypothesis.vendor").joinpath("tlds-alpha-by-domain.txt").read_text() Traceback (most recent call last): ... File "example.py", line 4, in <module> read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "python3.11/importlib/_legacy.py", line 25, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "python3.11/importlib/_legacy.py", line 67, in read_text with open_text(package, resource, encoding, errors) as fp: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "python3.11/importlib/_legacy.py", line 25, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "python3.11/importlib/_legacy.py", line 50, in open_text return (_common.files(package) / _common.normalize_path(resource)).open( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "python3.11/importlib/_adapters.py", line 141, in open raise FileNotFoundError("Can't open orphan path") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: Can't open orphan path At first I thought this was just a problem with the _legacy shims, but since it also affects the new files() API it might be more serious. ---------- components: Library (Lib) messages: 408107 nosy: Zac Hatfield-Dodds, barry priority: normal severity: normal status: open title: importlib.resources.read_text() raises FileNotFound type: behavior versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46026> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com