Patrick
unread,Aug 13, 2010, 1:39:27 PM8/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Protocol Buffers
I apologize if this is a repost but I could not find any information
searching the forums. I am trying to import two simple protos into
python 2.6.
D:\proto\src\MyProtos\foo.proto
package foobar;
option java_package = "foobar";
option java_outer_classname = "Foo";
message Foo
{
optional string the_foo = 1;
}
D:\proto\src\MyProtos\bar.proto
package foobar;
option java_package = "foobar";
option java_outer_classname = "Bar";
import "MyProtos/foo.proto";
message Bar
{
optional Foo my_foo = 1;
optional string bar_string = 2;
}
I compile the protos in windows with the following command:
D:\proto>protoc.exe --proto_path=src/ --python_out=build/gen src/
MyProtos/foo.proto src/MyProtos/bar.proto
I then run the following python script:
import sys
sys.path.append("D:\\proto\\build\\gen\\")
import foo_pb2
import bar_pb2
and receive the following error:
Traceback (most recent call last):
File "D:\Code\python\lbmpymodule\lbmpymodule\Release\test.py", line
15, in <module>
import bar_pb2
File "D:\Code\python\lbmpymodule\lbmpymodule\Release\bar_pb2.py",
line 52, in <module>
import MyProtos.foo_pb2
ImportError: No module named MyProtos.foo_pb2
What do I need to do to properly import these two protos into python.
Thanks,
Patrick