When I install latest package 5.2.1, it installed protobuf > 3.20.x which resulted in the following error:
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/__init__.py", line 115, in <module>
from tablestore.client import OTSClient
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/client.py", line 25, in <module>
from tablestore.protocol import OTSProtocol
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/protocol.py", line 25, in <module>
from tablestore.encoder import OTSProtoBufferEncoder
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/encoder.py", line 7, in <module>
from tablestore.metadata import *
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/metadata.py", line 6, in <module>
import tablestore.protobuf.search_pb2 as search_pb2
File "/app/.tox/py38/lib/python3.8/site-packages/tablestore/protobuf/search_pb2.py", line 33, in <module>
_descriptor.EnumValueDescriptor(
File "/app/.tox/py38/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 755, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
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.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
When I install latest package 5.2.1, it installed protobuf > 3.20.x which resulted in the following error:
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates