502 由协议 >= 3.19.0

问题描述 投票:0回答:1
023-06-25 07:18:17 default[20230625t071600]  Traceback (most recent call last):    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker      worker.init_process()    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process      self.load_wsgi()    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi      self.wsgi = self.app.wsgi()    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi      self.callable = self.load()    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load      return self.load_wsgiapp()    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp      return util.import_app(self.app_uri)    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/util.py", line 359, in import_app      mod = importlib.import_module(module)    File "/layers/google.python.runtime/python/lib/python3.8/importlib/__init__.py", line 127, in import_module      return _bootstrap._gcd_import(name[level:], package, level)    File "<frozen importlib._bootstrap>", line 1014, in _gcd_import    File "<frozen importlib._bootstrap>", line 991, in _find_and_load    File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked    File "<frozen importlib._bootstrap>", line 671, in _load_unlocked    File "<frozen importlib._bootstrap_external>", line 843, in exec_module    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed    File "/workspace/main.py", line 4, in <module>      from google.cloud import datastore    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/datastore/__init__.py", line 59, in <module>      from google.cloud.datastore.batch import Batch    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/datastore/batch.py", line 24, in <module>      from google.cloud.datastore import helpers    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/datastore/helpers.py", line 31, in <module>      from google.cloud.datastore.key import Key    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/datastore/key.py", line 23, in <module>      from google.cloud.datastore import _app_engine_key_pb2    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/datastore/_app_engine_key_pb2.py", line 36, in <module>      _descriptor.FieldDescriptor(    File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 561, in __new__      _message.Message._CheckCalledFromGeneratedFile()  TypeError: Descriptors cannot not be created directly.
2023-06-25 07:18:17 default[20230625t071600]  If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.

我这样做了,但仍然没有成功:

您提供的错误消息表明 google.cloud.datastore 模块和描述符的创建存在问题。错误消息表明生成的代码已过期,需要使用 protoc >= 3.19.0 重新生成。

python flask google-cloud-platform protocol-buffers
1个回答
0
投票

我也遇到了类似的错误。以下是对我有用的

pip install protobuf==3.20.*

© www.soinside.com 2019 - 2024. All rights reserved.