When using the generated Python code from our protobuf classes, we get this error:
cannot import name descriptor_pb2
The equivalent C++ generated code works just fine, so it would appear that there is no problem with our actual proto definitions.
This error occurs when I try and import our class, like so:
import sys
sys.path.append('..\path\to\generated')
sys.path.append('..\contrib\protobuf\python')
from foobar_pb2 import FooBar
Is it correct to append the system paths?
I checked in the protobuf\python\google\protobuf
directory for descriptor_pb2.py
but only found descriptor.py
- we're using the latest version, so I assume we don't have any files missing.
Does anyone know what the solution is?