Thanks a lot for the suggestions. I can import the any.proto correctly into
my proto files.
Wanted to ask about importing other proto files not provided by
google protobuf but different python libraries.
eg. tensorflow/core/framework/tensor.proto or onnx/onnx.proto
i.e
import "onnx/onnx.proto";
message Test {
onnx.TensorProto var = 1;
}
Do I have to copy over the files and use them or the protoc compiler can
detect that from my site-packages?
Same is the case for other proto files eg. import
"tensorflow/core/framework/tensor.proto"
On Tuesday, August 21, 2018 at 12:16:12 AM UTC-5, Feng Xiao wrote:
>
>
>
> On Mon, Aug 20, 2018 at 10:02 PM Siddharth <[email protected]
> <javascript:>> wrote:
>
>> Hi feng,
>>
>> Can we convert JSON object into Google.protobuf.Any format? If yes, can
>> you provide an example. Thanks for the help.
>>
> Check out the Any unittest examples:
>
> https://github.com/google/protobuf/blob/master/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java#L835
>
>
>>
>> Thanks,
>> Sid
>>
>> On Tue, Aug 21, 2018, 10:27 AM 'Feng Xiao' via Protocol Buffers <
>> [email protected] <javascript:>> wrote:
>>
>>>
>>>
>>> On Mon, Aug 20, 2018 at 9:24 PM akshay patil <[email protected]
>>> <javascript:>> wrote:
>>>
>>>> I have protoc installed which I can run via command line. I did install
>>>> protobuf using conda and when I check in my site-packages in my python
>>>> environment under ` site-packages/google/protobuf ` I do not see any
>>>> *.proto files
>>>>
>>> They are not in your python site-packages, but should be installed along
>>> side with the protoc binary. Check where your protoc is and look around to
>>> see if the protos are install there.
>>>
>>> Try compile the following proto and see if protoc can find the right
>>> imports:
>>>
>>> syntax = "proto3";import "google/protobuf/any.proto";
>>>
>>> message Test {
>>> google.protobuf.Any var1 = 1;}
>>>
>>> If you are unsure whether your proto definition is valid (your original
>>> one has a invalid import path and incomplete type name for Any), try it
>>> here:
>>> https://unpkg.com/[email protected]/index.html
>>>
>>> If you can get it working it on this site, you should be able to get it
>>> working locally as well.
>>>
>>>
>>>>
>>>> On Monday, August 20, 2018 at 11:09:10 PM UTC-5, Feng Xiao wrote:
>>>>>
>>>>> Have you install protocol compiler, i.e., protoc? These protos should
>>>>> be installed along with the protoc binary if you get it from our release
>>>>> page.
>>>>>
>>>>> On Mon, Aug 20, 2018 at 8:13 PM akshay patil <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I am trying to define my own messages representing python classes
>>>>>> that I want to serialize. However, I need to import any.proto or
>>>>>> timestamp.proto in my .proto files to represent certain messages
>>>>>>
>>>>>> syntax = "proto3";import "/google/protobuf/any.proto";
>>>>>>
>>>>>> message Test {
>>>>>> Any var1 = 1;}
>>>>>>
>>>>>>
>>>>>> However, seems like the protobuf installation does not come with any
>>>>>> .proto files. I am using python 3.5 and have protobuf 3.5.2 installed. I
>>>>>> tried to look under google/protobuf/ but just found the compiled
>>>>>> files like ant_pb2.py and timestamp_pb2.py. I am following docs here
>>>>>> to import any.proto -
>>>>>> https://developers.google.com/protocol-buffers/docs/proto3#any
>>>>>>
>>>>>> --
>>>>>> 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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>> 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 [email protected] <javascript:>.
>>>> To post to this group, send email to [email protected]
>>>> <javascript:>.
>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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 [email protected] <javascript:>.
>>> To post to this group, send email to [email protected]
>>> <javascript:>.
>>> Visit this group at https://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.