Relates to my (awan1) comment on this issue 
<>. I am struggling with 
including a Python package generated from a protobuf package, because the 
way protobuf compiles an import statement is

    import "a/b/c.proto"    ->    from a.b import c_pb2

and when the resultant package is included in a wider package, it gives an 
ImportError: no module named a.b.

At this point I'd be happy if anyone had a good workaround. I am going to 
have to resort to path-wrangling in each file that tries to import this 
package, which is ugly but works. The dream solution (as mentioned in the 
Github issue) is to have protoc generate nice relative imports and complete 
packages... And given that the "package" label is given and ignored for 
protobuf, this doesn't seem impossible: when compiling a package, use that 
to figure out how the path names should be changed to relative imports? 

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to