How to assign a value to an embedded message field in Protocol buffer Python -


i have following proto , trying assign value embedded message field

message foo {   required bar bar = 1; } message bar {   optional int32 = 1; }  

when writing following code in python, gives below error

foo = foo() foo.bar.i = 1 

error:

attributeerror: 'instancemethod' object has no attribute 'i'

how deal error?

to want, in python, have define bar method within foo class. it:

class foo:     = 1      def bar(self):         return self.i  if __name__ == '__main__':     foo = foo()     foo.bar = 1     print(foo.bar)  # print 1 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -