AC.
AC.

Reputation: 754

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

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?

Upvotes: 0

Views: 1938

Answers (1)

AC.
AC.

Reputation: 754

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.

Upvotes: 3

Related Questions