As explained in google protobuf documentation, the SerializeToString method only accept keyword arguments. In some settings, as spotted by Robert and Danny, the following exception will be raised when calling SerializeToString(True), i.e., a positional argument instead of a keyword argument is passed.
TypeError: _AddSerializeToStringMethod.<locals>.SerializeToString() takes 1 positional argument but 2 were given
Solution
Change SerializeToString(True) to SerializeToString(deterministic=True).
Motivation
As explained in google protobuf documentation, the
SerializeToString
method only accept keyword arguments. In some settings, as spotted by Robert and Danny, the following exception will be raised when callingSerializeToString(True)
, i.e., a positional argument instead of a keyword argument is passed.Solution
Change
SerializeToString(True)
toSerializeToString(deterministic=True)
.