I've been trying to add values to a ScalarMapContainer in Python. This object was autogenerated by Google's Protobuf3 library from the .proto:
map<string, string> mapName = 4;
According to the scant docs I found the ScalarMapContainer should act basically like a normal dict but doesn't.
I've tried accessing it like a normal dict. I deep copied it then called MergeFrom on the copy. I also created a new ScalarMapConatiner then called MergeFrom on it.
# normal dict
x.mapName["key"] = "value"
from google.protobuf.json_format import MessageToJson
print(MessageToJson(x)) # key/value not present
# deep copy
copy = deepcopy(x.mapName)
copy["key"] = "value"
x.mapName.MergeFrom(copy)
print(MessageToJson(x)) # key/value not present
# new object
myMap = ScalarMapContainer()
myMap["key"] = "value"
x.mapName.MergeFrom(myMap) # crashes
I'm not sure what else to try to get this working.
Thank you.