protobuf-2.3.0 : Problem generating python files with protoc

1,712 views
Skip to first unread message

dear chap

unread,
Apr 7, 2010, 2:27:52 PM4/7/10
to Protocol Buffers
I have this weird problem when generating python files from .proto
files using protoc. I am running protoc on addressbook.proto
and in the addressbook_pb2.py I have this string

DESCRIPTOR = descriptor.FileDescriptor(
name='addressbook.proto',
package='tutorial',
serialized_pb='\n\x11\x61\x64\x64ressbook.proto\x12\x08tutorial\"\xda
\x01\n\x06Person\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\n\n\x02id
\x18\x02 \x02(\x05\x12\r\n\x05\x65mail\x18\x03 \x03(\t\x12+\n\x05phone
\x18\x04 \x03(\x0b\x32\x1c.tutorial.Person.PhoneNumber\x1aM\n
\x0bPhoneNumber\x12\x0e\.........'

before the _PERSON_PHONETYPE = descriptor.EnumDescriptor definitions

Due to this I am unable to use any of the generated python classes in
other scripts. I installed protobuf-2.2.0 on same machine and it does
not output that string so I am able to use the genereated files
without any issues. Version of python being used is 2.6.4.

Jason Hsueh

unread,
Apr 7, 2010, 3:01:53 PM4/7/10
to dear chap, Protocol Buffers
What error do you get when trying to use the generated class? With python 2.5.2 I was able to execute the sample add_person.py program.


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


dear chap

unread,
Apr 8, 2010, 4:22:13 PM4/8/10
to Protocol Buffers
File "/home/bingo/protobuf-2.3.0/examples/addressbook_pb2.py", line
10, in <module>
DESCRIPTOR = descriptor.FileDescriptor(
AttributeError: 'module' object has no attribute 'FileDescriptor'

> > protobuf+u...@googlegroups.com<protobuf%2Bunsubscribe@googlegroups.c om>

Kenton Varda

unread,
Apr 8, 2010, 5:21:43 PM4/8/10
to dear chap, Protocol Buffers
It sounds like you installed the new version of protoc but forgot to install the new version of the python protobuf package.  You have to actually follow the installation instructions in python/README.txt.

To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.

dear chap

unread,
Apr 9, 2010, 8:43:22 AM4/9/10
to Protocol Buffers
Looks like that. Works fine now. Thanks Kenton

> > <protobuf%2Bunsubscr...@googlegroups.c om>

Reply all
Reply to author
Forward
0 new messages