'RepeatedCompositeFieldContainer' object has no attribute 'extend'

7,218 views
Skip to first unread message

William Tu

unread,
May 2, 2011, 9:54:02 PM5/2/11
to Protocol Buffers
Hi,
I just downloaded the protocol buffer 2.4.1 and I followed the foo bar
example for python.
http://code.google.com/apis/protocolbuffers/docs/reference/python-generated.html
However, I got an error when I call extend (the rest are fine)

---------------------
foo = Foo()
bar = foo.bars.add() # Adds a Bar then modify
bar.i = 15
foo.bars.add().i = 32 # Adds and modify at the same time
new_bar = Bar()
new_bar.i = 47
foo.bars.extend([new_bar])
----------------------
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'RepeatedCompositeFieldContainer' object has no
attribute 'extend'

Am I using the wrong version of protocol buffer? My python is 2.6
Thanks!

William

Pherl Liu

unread,
May 3, 2011, 1:15:03 AM5/3/11
to William Tu, Protocol Buffers
This is probably a wrong version problem. Have you installed previous versions? Could you try:

import google.protobuf
print google.protobuf.__file__


--
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.


Reply all
Reply to author
Forward
0 new messages