Re: [protobuf] Importing Protos In Python

2010-08-17 Thread Kenton Varda
On Fri, Aug 13, 2010 at 10:39 AM, Patrick doherty.patr...@gmail.com wrote:

 import foo_pb2
 import bar_pb2


Shouldn't these be:

  import MyProtos.foo_pb2
  import MyProtos.bar_pb2

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Importing Protos In Python

2010-08-13 Thread Patrick
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:\protoprotoc.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

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.