Python ParseFromString always returns None

2,473 views
Skip to first unread message

jsia

unread,
May 21, 2011, 4:22:27 AM5/21/11
to Protocol Buffers
Hi,

I created a proto file and did something like this

data = test_pb2.Payload()
data.id = 1234

output = data.SerializeToString()

print data.ParseFromString(output)

The output is always None

I tried deserializing it in java and it worked , is this a bug?

Pherl Liu

unread,
May 24, 2011, 4:17:57 AM5/24/11
to jsia, Protocol Buffers, Will Robinson
+robinson

The ParseFromString() in python now always returns None. Note the MergeFromString() returns the number of bytes read, but there's a TODO to make that always return None. Will may have some ideas about this.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
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.


Li Qian

unread,
Sep 26, 2013, 7:58:41 AM9/26/13
to prot...@googlegroups.com
I posted an answer here:
http://lqian.net/b/why-does-google-protobufs-api-parsefromstring-always-return-none/

In short, you were using the API in a wrong way.

在 2011年5月21日星期六UTC+8下午4时22分27秒,jsia写道:

Prasanna Kanagasabai

unread,
Mar 17, 2014, 1:14:24 PM3/17/14
to prot...@googlegroups.com
Thank You Li for the answer !! 

PK

Nagesh .Allur

unread,
Mar 23, 2015, 1:09:19 PM3/23/15
to prot...@googlegroups.com
Hi Prasanna how did you solve the problem i am facing same issue

Nagesh .Allur

unread,
Mar 23, 2015, 1:09:19 PM3/23/15
to prot...@googlegroups.com
Hi ,

I am facing the same problem ParseFromString returning None ,how to solve this

BR

Nagesh

chiti...@gmail.com

unread,
Aug 1, 2017, 5:24:53 AM8/1/17
to Protocol Buffers

Web can`t load , could you please help me about the problem?
Thanks~


在 2013年9月26日星期四 UTC+8下午7:58:41,Li Qian写道:

Donovon Carter

unread,
Nov 13, 2017, 10:58:01 AM11/13/17
to Protocol Buffers
Li,

When I attempt to access your site I receive the following error: This program is locked to another domain.

Is it possible you could post your API documentation here?
Many thanks. 

guttula smash

unread,
Feb 28, 2018, 2:53:26 PM2/28/18
to Protocol Buffers
For the people of the future: in January 2018 the api was the same as in 2013 and it should be done like this:

#wrong
print data.ParseFromString(output)

#correct
data.ParseFromString(output)
print(data)

Link to the site that doesn't open: https://web.archive.org/web/20151122134246/http://lqian.net/b/why-does-google-protobufs-api-parsefromstring-always-return-none/
Reply all
Reply to author
Forward
0 new messages