Python protobuf 3.20.1 is missing Any, Empty, and other types

1,116 views
Skip to first unread message

Aleksey Chernoraenko

unread,
May 22, 2022, 7:38:47 PM5/22/22
to Protocol Buffers

Hello,

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 should I construct Empty or StringValue objects now?


Cheers,
Alexei

Deanna Garcia

unread,
Aug 1, 2022, 2:28:00 PM8/1/22
to Protocol Buffers
Your syntax for importing is a bit off, see this file for an example of how to use well known types. The implementation of our well known types is internal since it is an implementation detail that users should not edit. 
Reply all
Reply to author
Forward
0 new messages