[英]How to use different buckets in GCS python?
I have:我有:
bucket_name = os.environ.get(
'mosaictest', app_identity.get_default_gcs_bucket_name())
But It would always show the default gcs bucket(for me it is "{project id}.appspot.com" instead of 'mosaictest'(I created this bucket) how do I use the "mosaictest' bucket?但它总是会显示默认的 gcs 存储桶(对我来说它是“{project id}.appspot.com”而不是“mosaictest”(我创建了这个存储桶)我如何使用“mosaictest”存储桶?
我是个白痴,只写:bucket_name={literally name the bucket you want to use lol}
Your code retrieves the value of an environment variable called mosaictest
and uses the value of that variable.您的代码检索名为
mosaictest
的环境变量的值并使用该变量的值。 If the variable is not set, then you will get the default value as returned from the get_default_gcs_bucket_name()
function call.如果未设置该变量,则您将获得从
get_default_gcs_bucket_name()
函数调用返回的默认值。 If you are finding that you are getting the default value then it is likely your environment variable is not set.如果您发现您获得的是默认值,那么您的环境变量可能未设置。 You didn't specify how you might have been setting it in your original post.
您没有在原始帖子中指定如何设置它。 In Linux, you would do something like:
在 Linux 中,您会执行以下操作:
export mosaictest=MYVALUE
python myapp.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.