You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because this is talking about a file tree, I would expect to be able to check for resources in sub directories inside the importable Python package.
This does not seem to be the case.
The example below has two issues I am wondering about:
How do I check if a directory exists?
Why the error dir1/file.txt' must be only a file name? it seems that this should be supported based on the project terminology.
$ python test.py
is_resource("package", "file.txt") True
is_resource("package", "dir1") False , how do I check if a directory exists?
is_resource("package", "dir1/file.txt") failed with dir1/file.txt' must be only a file name'
is_resource("package.dir1", "file.txt") False need an __init__.py in dir1
Thanks.
The text was updated successfully, but these errors were encountered:
In GitLab by @omry3 on Jun 24, 2020, 22:59
From https://importlib-resources.readthedocs.io/en/latest/:
"In our terminology, a resource is a file tree that is located within an importable Python package."
Because this is talking about a file tree, I would expect to be able to check for resources in sub directories inside the importable Python package.
This does not seem to be the case.
The example below has two issues I am wondering about:
dir1/file.txt' must be only a file name
? it seems that this should be supported based on the project terminology.Source tree: test-importlib.zip
Structure:
Output:
Thanks.
The text was updated successfully, but these errors were encountered: