I have my .proto
. files defined in a folder workspace_directory/sub_directory/proto_files
.
When I run:
protoc --python_out=workspace_directory -I workspace_directory/sub_directory/proto_files workspace_directory/sub_directory/proto_files/*
the output python code is generated in workspace_directory/proto_files
, which is what I want.
My main goal is to run that command as part of a build script in Python, so I attempted to use subprocess.run()
to achieve that. In Python I run:
subprocess.run(shlex.split("protoc --python_out=workspace_directory -I workspace_directory/sub_directory/proto_files workspace_directory/sub_directory/proto_files/*"))
I get
Could not make proto path relative: workspace_directory/sub_directory/proto_files/*: No such file or directory
Some other things to note:
workspace_directory
is a fully qualified path. Its like/home/user/workspace_directory
, so I don't believe I should be having any relative path problems.- I used
shlex.split()
so I could copy/paste the command, to ensure it was as exact as possible.
It feels like I'm missing something when using the subprocess
module, but can't seem to see it.