build_file_import_whitelist = os.path doesn't work
See original GitHub issue[project]
build_file_import_whitelist = os.path
doesn’t work—I get the error
AttributeError: Using function expanduser is forbidden in the safe version of module os.path. If you really need to use this function read about allow_unsafe_import() documented at: https://buckbuild.com/function/allow_unsafe_import.html
Is this because the module name has multiple parts? Is it because Buck already imports the “safe” version of os.path
? How can I whitelist os.path
methods without using allow_unsafe_import()
everywhere?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
os.walk without digging into directories below - Stack Overflow
Don't use os.walk. Example: import os root = "C:\\" for item in os.listdir(root): if os.path.isfile(os.path.join(root, item)): print item.
Read more >allow_unsafe_import() - Buck
Some modules can be imported in a normal way (without using allow_unsafe_import() ) because they were whitelisted or a safe version was configured....
Read more >How to Check If a File Exists in Python
To check if a file exists, you pass the file path to the exists() function from the os.path standard library. First, import the...
Read more >build/check_gn_headers.py - chromium/src - Git at Google
"""Find header files missing in GN. This script gets all the header files from ninja_deps, which is from the true. dependency generated ...
Read more >os.path — Common pathname manipulations — Python 3.11 ...
This module implements some useful functions on pathnames. To read or write files see open() , and for accessing the filesystem see the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, that’s even simpler than what I was thinking! Nice 😃
using
os.path.exists()
to check for test resources directory is a bad idea, because buck is not aware of this and would have no way to know what exactly should be invalidated and in you can easily end up in a situation with non-reproducible and hard to understand failure. If nothing else you can probably at least use something like: