gpt4 book ai didi

python-3.x - Google Cloud SDK 正在尝试访问不存在的 gslib.USER_AGENT

转载 作者:行者123 更新时间:2023-12-03 14:39:49 28 4
gpt4 key购买 nike

最近更新后,我的 gsutil 命令失败并出现以下异常:

gsutil cp /Users/myself/my-project/client/libs/image-content-2020-6-23.jar gs://my-bucket/content
Traceback (most recent call last):
File "/Users/myself/google-cloud-sdk/platform/gsutil/gsutil", line 21, in <module>
gsutil.RunMain()
File "/Users/myself/google-cloud-sdk/platform/gsutil/gsutil.py", line 123, in RunMain
sys.exit(gslib.__main__.main())
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 429, in main
return _RunNamedCommandAndHandleExceptions(
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 767, in _RunNamedCommandAndHandleExceptions
_HandleUnknownFailure(e)
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 625, in _RunNamedCommandAndHandleExceptions
return command_runner.RunNamedCommand(command_name,
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/command_runner.py", line 411, in RunNamedCommand
return_code = command_inst.RunCommand()
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 1205, in RunCommand
self.Apply(_CopyFuncWrapper,
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/command.py", line 1485, in Apply
caller_id = self._SetUpPerCallerState()
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/command.py", line 1360, in _SetUpPerCallerState
class_map[caller_id] = cls
File "<string>", line 2, in __setitem__
File "/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/managers.py", line 850, in _callmethod
raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError:
---------------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/managers.py", line 243, in serve_client
request = recv()
File "/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 30, in <module>
from gslib.command import Command
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/command.py", line 50, in <module>
from gslib.cloud_api_delegator import CloudApiDelegator
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/cloud_api_delegator.py", line 26, in <module>
from gslib.cs_api_map import ApiMapConstants
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/cs_api_map.py", line 23, in <module>
from gslib.gcs_json_api import GcsJsonApi
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/gcs_json_api.py", line 72, in <module>
from gslib.third_party.storage_apitools import storage_v1_client as apitools_client
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 26, in <module>
class StorageV1(base_api.BaseApiClient):
File "/Users/myself/google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 38, in StorageV1
_USER_AGENT += gslib.USER_AGENT
AttributeError: module 'gslib' has no attribute 'USER_AGENT'
---------------------------------------------------------------------------
这是我的 gcloud 版本:
$ gcloud version
Google Cloud SDK 297.0.1
bq 2.0.58
core 2020.06.17
gsutil 4.51
以下是 gcloud 使用的 Python 版本:
$ printenv CLOUDSDK_PYTHON
/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python

$ /usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python -V
Python 3.8.3
我 brew 重新安装了 python@3,重新安装了谷歌云 SDK,但没有任何效果。
现在,我已经在违规文件中注释掉了这一行:
File: google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py

_VERSION = u'v1'
_CLIENT_ID = 'nomatter'
_CLIENT_SECRET = 'nomatter'
_USER_AGENT = 'apitools Python/%s' % platform.python_version()
# I commented out this line here:
#_USER_AGENT += gslib.USER_AGENT

_CLIENT_CLASS_NAME = u'StorageV1'
_URL_VERSION = u'v1'
_API_KEY = None
这暂时解决了这个问题,我的 gsutil cp 命令现在成功了。
这是 Google Cloud SDK 错误,还是我的系统有问题?

最佳答案

本期has been flaggedgsutil库,并且已修复 merged .正在gsutil中发布版本302.0.0 ,计划于 2020 年 7 月 21 日发布。
如果您需要立即解决此问题,您可以回滚到版本 297.0.1使用 following command :

gcloud components update --version 297.0.1

关于python-3.x - Google Cloud SDK 正在尝试访问不存在的 gslib.USER_AGENT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62544323/

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