gpt4 book ai didi

python - 谷歌云存储python客户端AttributeError : 'ClientOptions' object has no attribute 'scopes' occurs after deployment

转载 作者:行者123 更新时间:2023-12-03 14:40:33 26 4
gpt4 key购买 nike

我正在将云存储与 App Engine Flex 结合使用。部署成功后,我突然开始收到此错误消息
错误发生在我的 Flask 应用程序中的这些行中。

from google.cloud import storage, datastore
client = storage.Client()
File "/home/vmagent/app/main.py", line 104, in _load_db
client = storage.Client()
File "/env/lib/python3.6/site-packages/google/cloud/storage/client.py", line 110, in __init__
project=project, credentials=credentials, _http=_http
File "/env/lib/python3.6/site-packages/google/cloud/client.py", line 250, in __init__
Client.__init__(self, credentials=credentials, client_options=client_options, _http=_http)
File "/env/lib/python3.6/site-packages/google/cloud/client.py", line 143, in __init__
scopes = client_options.scopes or self.SCOPE
AttributeError: 'ClientOptions' object has no attribute 'scopes'
这与基于大量 SO 线程对 grpcio 和 google-api-core 以及 google-cloud-storage 软件包进行的重大升级有关。但是,我无法弄清楚这是在哪里发生的。
我的requirements.txt如下:
setuptools>=40.3
grpcio<=1.27.2
google-api-core<1.17.0
Flask

gevent>=0.13

gunicorn>=19.7.1
numpy>=1.18.0
numpy-financial
scipy>=1.4
pvlib>=0.7
google-cloud-storage==1.28.0
google-cloud-datastore==1.12.0
google-cloud-pubsub
pandas==1.0.5
我的 app.yaml 如下:
service: app-preprod
runtime: custom
env: flex
entrypoint: gunicorn -t 600 -c gunicorn.conf.py -b :$PORT main:app


runtime_config:
python_version: 3.6
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 4
beta_settings:
cloud_sql_instances: xxxx:europe-west6:component-cost

endpoints_api_service:
name: apipreprod-dot-xxxx.appspot.com
rollout_strategy: managed
查看发布历史,几天前发布了一些新版本的 google-cloud-storage 等,但我试图保持相同的旧版本号。
荒谬的是,使用这些完全相同的 requirements.txt,我有一个完全相同的 prod 应用程序引擎,它工作正常——但我已经一周没有重新部署了。
显然,使用完全相同版本的存储和数据存储从我的本地机器运行客户端完全没有问题。
- 编辑 -
显然根据
https://github.com/googleapis/google-cloud-python/issues/10471
我应该添加 google-cloud-core==1.3.0到需求.txt
这似乎是一种解决方法 --- 有没有更好的永久方式来确保这次休息不会让我措手不及?

最佳答案

这是由于 https://github.com/googleapis/google-cloud-python/issues/10471 .
我建议升级 google-cloud-coregoogle-api-core到带有错误修正的最新版本。

关于python - 谷歌云存储python客户端AttributeError : 'ClientOptions' object has no attribute 'scopes' occurs after deployment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63278444/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com