gsutil fails to run when PYTHONSAFEPATH=1 is set
thirtyseven opened this issue · 1 comments
thirtyseven commented
Host information
Python version: 3.11.x (from Homebrew)
OS: macOS 13.4.1
Steps to reproduce:
export PYTHONSAFEPATH=1
gsutil
Expected output:
Usage: gsutil [-D] [-DD] [-h header]... [-i service_account] [-m] [-o section:flag=value]... [-q] [-u user_project] [command [opts...] args...]
...
Actual output:
Traceback (most recent call last):
File "/Users/tkaplan/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 15, in <module>
import bootstrapping
ModuleNotFoundError: No module named 'bootstrapping'
Context
bazel run
sets this environment variable when running Python scripts (see https://github.com/bazelbuild/bazel/blob/b70914d269e1ee688a82606e92af6582bf67a56b/tools/python/python_bootstrap_template.txt#L485), this issue makes it difficult to shell out to gsutil
from a Python script run by Bazel.
siddharthab commented
This is also true for gcloud by the way.