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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to