Python Protobuf 3.20.1缺少任何,空和其他类型

发布于 2025-01-31 04:00:44 字数 509 浏览 1 评论 0原文

我刚刚将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和其他包装器类型。

它是一个已知的错误,还是我缺少一些东西? 现在,某人如何构造emptyStringValue对象?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆依然 2025-02-07 04:00:44

好的,我发现了我的问题。首先,一切都起作用了,但是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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文