Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Protocol Buffers with Python (I'm a noob)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
steph  
View profile  
 More options Sep 20 2012, 4:07 pm
From: steph <preston....@gmail.com>
Date: Thu, 20 Sep 2012 13:07:49 -0700 (PDT)
Local: Thurs, Sep 20 2012 4:07 pm
Subject: Protocol Buffers with Python (I'm a noob)

I have been using protocol buffers with Cpp and Java and have gotten those
running smoothly but I'm having trouble with python (admittedly I'm not
very good with python so hopefully this isn't just me goofing something).

I have the main protocol buffer files, the source, protoc, protogen, all in
one central location so that my build processes from Java and cpp can
utilize the same files. Then in my java project I include proto2javame.jar
and in cpp I include Google.Protocolbuffers.dll and that allows me to use
the generated classes. However I can't find an equivalent for python. I
have generated my python libraries but when I try to use them I get errors
that No Module named google.protobuff exist (i'm using python 3.2.3).

How do I have my python generated classes import the appropriate libraries
while still keeping all of my protobuff binaries in a central location? Is
there a way to modify my build argument to include all necessary libraries.

My current build line looks like
%1 is the current protocol buffer file

>protoc --descriptor_set_out = %1.bin --proto_path=[mycomputerpath]\protos

--proto_path=. --include_imports --python_out=. %1.proto

thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Roper  
View profile  
 More options Sep 21 2012, 9:29 am
From: Alex Roper <calmofthest...@gmail.com>
Date: Fri, 21 Sep 2012 06:29:00 -0700 (PDT)
Subject: Re: Protocol Buffers with Python (I'm a noob)

That should generate one or more files of the form package_pb2.py in the
directory you ran protoc in. You can then import these into your program
with:

import package_pb2

where package is the PB package you want.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
steph  
View profile  
 More options Sep 21 2012, 9:44 am
From: steph <preston....@gmail.com>
Date: Fri, 21 Sep 2012 06:44:21 -0700 (PDT)
Local: Fri, Sep 21 2012 9:44 am
Subject: Re: Protocol Buffers with Python (I'm a noob)

I'm able to import the generated protobuf files using import classa_pb2.py
but the problem is when I then attempt to use classa_pb2 it throws errors
before inside classa_pb2.py it it throws an ImportError: No Module name
google.protobuf on the line "from google.protobuf import descriptor"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Roper  
View profile  
 More options Sep 22 2012, 9:53 am
From: Alex Roper <calmofthest...@gmail.com>
Date: Sat, 22 Sep 2012 06:53:42 -0700 (PDT)
Local: Sat, Sep 22 2012 9:53 am
Subject: Re: Protocol Buffers with Python (I'm a noob)

When I've gotten this in the past it has been because either the protobuf
libraries or the python bindings to them were not properly installed or
were from different versions.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »