I get the “TypeError: RepeatedCompositeFieldContainer object does not support item assignment” when accessing the Protobuf map in Python
Proto definition:
syntax = "proto3";
package test;
message TestMap {
map<string, string> myMap = 1;
}
Accessing from Python:
test = test.TestMap()
test.myMap["key"] = "value"
The error message I get is:
File "PythonTest.py", line 19, in testfunction
test.myMap["key"] = "value"
│ └ <google.protobuf.internal.python_message._FieldProperty object at 0x7f9866137820>
└
File "..../python-3.11/lib/python3.11/site-packages/google/protobuf/internal/containers.py", line 325, in __setitem__
raise TypeError(
TypeError: RepeatedCompositeFieldContainer object does not support item assignment
Protobuf version: 4.25.1
What could be the issue? Thanks
1