[issue44137] importlib.resources.path raises RuntimeError when FileNotFoundError is raise in context manager

Nils Kattenbeck report at bugs.python.org
Mon May 17 11:05:40 EDT 2021


Nils Kattenbeck <nilskemail at gmail.com> added the comment:

Yes I understand that the function handles this specially to not raise an exception if the file is not found in the package (even though the intention behind this is not clear to me). However if a user causes a FileNotFoundException itself inside of the context manager everything breaks (e.g. does something erroneous with the path, calls subprocess.run with a non existing binary etc).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44137>
_______________________________________


More information about the Python-bugs-list mailing list