Python Protobuf 3.20.1缺少任何,空和其他类型
我刚刚将Protobuf从3.17.3升级到3.20.1(MacOS,Python 3.9),我的代码开始抱怨没有
from google.protobuf.empty_pb2 import Empty
from google.protobuf.timestamp_pb2 import Timestamp
我在./ venv/lib/python3.9/site-packages下检查包装文件夹/google/protobuf/
,实际上没有空的
在那里键入。
好的,我在internal/well_known_types.py
中找到了时间戳。 为什么要内部?这没有道理。
也找不到StringValue
和其他包装器类型。
它是一个已知的错误,还是我缺少一些东西? 现在,某人如何构造empty
或StringValue
对象?
I just upgraded protobuf from 3.17.3 to 3.20.1 (macos, python 3.9), and my code started complaining that there is no
from google.protobuf.empty_pb2 import Empty
from google.protobuf.timestamp_pb2 import Timestamp
I checked the package folder under ./venv/lib/python3.9/site-packages/google/protobuf/
and indeed there is no Empty
type there.
Ok, I found Timestamp in internal/well_known_types.py
.
Why internal? It does not make sense.
Also cannot find StringValue
and other wrapper types.
Is it a known bug, or I'm missing something?
How does someone construct Empty
or StringValue
objects now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我发现了我的问题。首先,一切都起作用了,但是IDE一直抱怨丢失类型,直到我安装了
types type-protobuf
软件包。OK, I found out my problem. Everything worked in the first place, but IDE had been complaining about missing types until I installed the
types-protobuf
package.