"I've encountered the same issue. Have you found a solution?
在2018年1月17日星期三 UTC+8 15:52:17<Alexander Luya> 写道:
> I have two packages like this
>
> com.abc.
> protobuf.
> share.proto
> depart.
> detect.proto
>
> and the conent of share.proto like this:
>
> syntax = "proto3";
> package com.adc.protobuf;
> message Test{}
>
> and the content of detect.proto like this:
>
> syntax = "proto3";
> package com.adc.depart;
> import "com/abc/protobuf/share.proto"
>
> and compile share.proto in it's dir like this:
>
> protoc -I=. --python_out=. share.proto
>
> then compile detect.proto in it's dir like this:
>
> protoc -I=/pathToSrcDir/ -I=. --python_out=. detect.proto
> and
>
> pathToSrcDir has been added to PYTHONPATH
>
> all compilations work fine,but when run a python script which
>
> from com.abc.depart import detect_pb2
>
> got this error
>
> TypeError: Couldn't build proto file into descriptor pool!
> Invalid proto descriptor for file "detect.proto":
> detect.proto: Import "com/abc/protobuf/share.proto" has not been
> loaded.
> com.abc.depert.XClass.ymethod: "com.abc.protobuf.Test" seems to be
> defined in "share.proto", which is not imported by "detect.proto". To use
> it here, please add the necessary import.
>
> How to solve this import problem?
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/ac3390fb-3963-4173-a4d7-ad535dc0e571n%40googlegroups.com.