The imports in proto files are relative to the search path (what you
provide by -I), not to the files. You either need to the Level2 directory
under the protobuf directory, or change the import in Level1.proto to
import "level1/level2/Level2.proto"

On Fri, Aug 28, 2020 at 9:54 PM Novice User <novice87m...@gmail.com> wrote:

> I've nested proto (proto3) files [ Level0.proto depends on Level1.proto
> which in turn depend on Level2.proto] with the below tree structure :
>
>
>
> Level0.proto
>
> syntax = "proto3";
> package protobufs;import "level1/Level1.proto";
> message Level0Message {
>   Level1Message level1message = 1;}
>
> Level1.proto
>
> syntax = "proto3";
> package protobufs.folderA;import "level2/Level2.proto";
> message Level1Message {
>     Level2Message level2Message = 1;}
>
> Level2.proto
>
> syntax = "proto3";
> package protobufs.folderA.folderB;
> message Level2Message {
>   string innerMost = 1;}
>
> Compilation fails :
>
> $ protoc -I=./ --python_out=. *.proto
> level2/Level2.proto: File not found.
> level1/Level1.proto:4:1: Import "level2/Level2.proto" was not found or had
> errors.
> level1/Level1.proto:7:5: "Level2Message" is not defined.
> Level0.proto:4:1: Import "level1/Level1.proto" was not found or had errors.
> Level0.proto:7:3: "Level1Message" is not defined.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/81E01306-D492-4B20-903C-E1943FCD86AA%40gmail.com
> <https://groups.google.com/d/msgid/protobuf/81E01306-D492-4B20-903C-E1943FCD86AA%40gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
-Nadav

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CANZcNEo%3DuJQ67m%3DNiW3-P7bhKgxFRZTxiwvj42B%2BWO%3D0FUi%3D2Q%40mail.gmail.com.

Reply via email to