'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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AC. |
