Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6002

Protobuf couldn't find timestamp.proto in Python

$
0
0

I have a Python module that imports a Protobuf class. When I try to run the module or the tests for that module, I get fhe following error:

_ ERROR collecting tests/test_load_protobuf_data.py _tests/test_load_protobuf_data:7: in <module>    from src.protobuf_classes import testdata_pb2 as Testdatasrc.protobuf_classes/testdata_pb2.py:17: in <module>    DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(E   TypeError: Couldn't build proto file into descriptor pool: Depends on file 'google/protobuf/timestamp.proto', but it has not been loaded

I expected the module to import all dependencies successfully and pytest to load the module and run the tests successfully.

I'm using a virtual environment for that project, but the timestamp.proto is not part of the protobuf library. Instead, the .proto files are stored under /usr/include/google/protobuf/.

I tried to copy the file to my project folder under google/protobuf/timestamp.proto, but this didn't solve the problem. I need a way to tell python/protobuf where to look for the proto files.


Viewing all articles
Browse latest Browse all 6002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>