Red Hat Bugzilla – Bug 509477
protobuf python binding broken in F11
Last modified: 2010-02-13 02:12:17 EST
Description of problem:
Python binding of protobuf 2.0.2 broken on import, quoted from the Google bug:
What is the expected output? What do you see instead?
There should be no output on a successful import of this code, but instead
this error occurs:
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.protobuf.descriptor_pb2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\lib\site-packages\google\protobuf\descriptor_pb2.py", line 737,
File "...\lib\site-packages\google\protobuf\reflection.py", line 141, in
superclass.__init__(cls, name, bases, dictionary)
TypeError: Error when calling the metaclass bases
type.__init__() takes 1 or 3 arguments
Version-Release number of selected component (if applicable):
How to fix:
Update to protobuf-2.0.3 or later
It can be fixed by hand editing the superclass.__init__ call to not include the cls parameter. But that's really, really ugly.
There is a much newer version (2.2.0) of protobuf available that fixes this issue and also includes numerous speed improvements. I also know that a version is coming fairly soon that includes some Python specific speed improvements.
This is now fixed since protobuf 2.2.0 was released, which was a couple of months ago at least.