Hello,I am using Python to write a tool to control our backends which communicate using protocol buffers.We would like our tool to be independent on current version of backends and therefore independent on .proto files that were used to build the particular version of the backend.Therefore the tool receives serialized FileDescriptorSet over network, which should allow to create messages from the same descriptors, that are used at the backend side.This is possible to implement in C++ (and we actually use it in another component) using DynamicMessage. (Create DescriptorPool, load all the FileDescriptors to the pool using BuildFile(), and then retrieve Descriptor from the pool. Then it is possible to create message using DynamicMessageFactory)However, after thorough research on the web and of the source code of protocol buffers python bindings, I couldn't figure out how to do this (version 2.4.0).I was able to deserialize FileDescriptorSet, iterate over FileDescriptorProtos and get DescriptorProto object. However I didn't find a way to construct Descriptor objects, which are needed to create classes for message types(with GeneratedProtocolMessageType as a metaclass).I tried another way, when I found some access to C++ library API in google.protobuf.internal (which is probably not a good idea to use). I tried to indirectly use the C++ descriptor pool by cpp_message.BuildFile(), but there is no way to get the Descriptor object back from the pool (it would be C++ object anyway). However there is a method cpp_message.NewCMessage, which can construct a message using descriptors from the pool. I was able to construct messages that way, but I was unable to set any fields. Only method that appeared usable was SetScalar, which requires C++ decriptor, which I was unable to get. Not to mention all of the Python magic is gone when dealing directly with the C++ API.Is there any way to create messages of arbitrary type, which is distributed over network, in Python ? I see those possibilities in both Java and C++, is Python library lacking such funcionality ?Thank you very much, hope I was clear enough.Best regards,¨Jan Koritak--
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/-/LEFgfPpImWEJ.
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.
Hi,
I am also looking for this feature. I saw the SVN update to CHANGES.txt.
Can you please confirm if this has been committed to the public svn ?
Thanks
To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/L9mSM7H-GywJ.
Hello,
2.5.0 is out for a while and requested features are mentioned within the changelog. Is there any usage example anywhere please?
Is announced "Added ParseMessage(descriptor, bytes) to generate a new Message instance from a descriptor and a byte string" a wrapper to simplify usege of announced "Added support for dynamic message creation. DescriptorDatabase, DescriptorPool, and MessageFactory work like their C++ couterparts to simplify Descriptor construction from *DescriptorProtos, and MessageFactory provides a message instance from a Descriptor"?
Or these two things are intended for different use cases?
Thanks, Tomas
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.