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"
On Friday, September 21, 2012 9:29:00 AM UTC-4, Alex Roper wrote: > > 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. > > On Thursday, September 20, 2012 4:07:49 PM UTC-4, steph wrote: >> >> 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 received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/NvoHubIPZpEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
