General Gravicius
General Gravicius

Reputation: 301

--proto_path passed empty directory name

I'm trying to compile a proto file with the following command:

protoc -I=. --python_out=. ./message.proto --proto_path=.

But I'm getting this error:

--proto_path passed empty directory name.  (Use "." for current directory.)

What to do?

Upvotes: 5

Views: 10342

Answers (3)

Banty
Banty

Reputation: 901

In my case, mixing short and long flags -I= and --python_out= was the problem.

$ protoc -I=. --python_out=. ./message.proto
--proto_path passed empty directory name.  (Use "." for current directory.)

solution:

$ protoc --proto_path=. --python_out=. ./message.proto

In your case, removing -I=. will fix the problem.

$ protoc --python_out=. ./message.proto --proto_path=.

Upvotes: 0

Yegor Bogdanov
Yegor Bogdanov

Reputation: 111

You should remove = in -I=. and also remove --proto_path=. flag

Upvotes: 11

DazWilkin
DazWilkin

Reputation: 40061

The command works for me.

NOTE -I == --proto_path so using both with the same value is redundant

One 'wrinkle' with protoc is that the protobuf files must be encapsulated by a proto_path.

So, in your case, the current directory must contain a valid message.proto file, both for ./message.proto to be a valid reference and because your --proto_path includes the current directory.

Upvotes: 0

Related Questions