protocol buffers - How do we use Python generated protobuf codes in to python code? -


i have installed protobuf in python 3.4 , pushed compiled code pb_x_pb2.py python34 folder. when enter import pb_x_pb2.py shows following error.

>>> import pb_interface_pb2 traceback (most recent call last):   file "<pyshell#21>", line 1, in <module>     import pb_interface_pb2   file "c:\python34\pb_interface_pb2.py", line 5, in <module>     google.protobuf import reflection   file "c:\python34\lib\site-packages\google\protobuf\reflection.py", line 68, in <module>     google.protobuf.internal import python_message   file "c:\python34\lib\site-packages\google\protobuf\internal\python_message.py", line 848     except struct.error, e:                        ^ syntaxerror: invalid syntax 

protobuf doesn't support python 3.x. imported libraries, try pip install protobuf-py3, python 3 port of package. can run 2to3.py script pythonxx\tools\scripts folder on generated file.

another option download newest version of sources, , compile them yourself. believe newest version compatible both 2.x , 3.x


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -