Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error finding custom protobuf plugin

When I try to generate code from .proto files using plugins I've downloaded, it works. For example, using the following works:

protoc --python_out=. --plugin=protoc-gen-python=$GOPATH/bin/protoc-gen-python ./hello.proto

and so does

protoc --go_out=. --plugin=protoc-gen-go=$GOPATH/bin/protoc-gen-go ./hello.proto

These commands generate proper stubs (pretty much does what the plugin wants them to do). However, the following gives an error:

protoc --custom_out=. --plugin=protoc-gen-custom=my-plugin.py ./hello.proto

The error simply says

my-plugin.py: program not found or is not executable --custom_out: protoc-gen-custom: Plugin failed with status code 1.

even though my-plugin.py is in my current directory

like image 874
staleMilk Avatar asked Apr 26 '26 13:04

staleMilk


1 Answers

Turns out my python script wasn't an executable; I had to add the following to the top: #!/usr/bin/env python

like image 111
staleMilk Avatar answered Apr 28 '26 02:04

staleMilk