You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am trying to send bytes rather than a string. I am using the following in the xml file: <member name="var1" type="short" sequenceMaxLength="9000" key="False" />
and trying to send the bytes using: output.instance.set_dictionary(dict)
where dict is define as {"var1": b'bytes to be sent (random)'}
but I get this error File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1062, in set_dictionary json_str = json.dumps(dictionary) File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "/usr/lib/python3.8/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/lib/python3.8/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type bytes is not JSON serializable
and when I use base64 I get his error: DDS_DynamicDataParser_parse_json_node:!parse json node can DDS_DynamicDataFormatter_from_json_w_params:!parse json node RTILuaDynamicData_set_from_json:DDS_DynamicDataFormatter_from_json_w_params RTILuaMetamethodImpl_OutData:!set from JSON operation failed with retcode 3 RTI_Connector_set_json_instance:!set Failed to set JSON Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1063, in set_dictionary _check_retcode(connector_binding.set_json_instance( File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 89, in _check_retcode raise Error("DDS Exception: " + _get_last_dds_error_message()) rticonnextdds_connector.rticonnextdds_connector.Error: DDS Exception: DDS_DynamicDataParser_parse_json_node:!parse json node can DDS_DynamicDataFormatter_from_json_w_params:!parse json node RTILuaDynamicData_set_from_json:DDS_DynamicDataFormatter_from_json_w_params RTILuaMetamethodImpl_OutData:!set from JSON operation failed with retcode 3 RTI_Connector_set_json_instance:!set Failed to set JSON
Any idea how to get this to work serializing bytes?
Thanks,
AE
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to send bytes rather than a string. I am using the following in the xml file:
<member name="var1" type="short" sequenceMaxLength="9000" key="False" />
and trying to send the bytes using:
output.instance.set_dictionary(dict)
where dict is define as
{"var1": b'bytes to be sent (random)'}
but I get this error
File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1062, in set_dictionary json_str = json.dumps(dictionary) File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "/usr/lib/python3.8/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/lib/python3.8/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type bytes is not JSON serializable
and when I use base64 I get his error:
DDS_DynamicDataParser_parse_json_node:!parse json node can DDS_DynamicDataFormatter_from_json_w_params:!parse json node RTILuaDynamicData_set_from_json:DDS_DynamicDataFormatter_from_json_w_params RTILuaMetamethodImpl_OutData:!set from JSON operation failed with retcode 3 RTI_Connector_set_json_instance:!set Failed to set JSON Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1063, in set_dictionary _check_retcode(connector_binding.set_json_instance( File "/usr/local/lib/python3.8/dist-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 89, in _check_retcode raise Error("DDS Exception: " + _get_last_dds_error_message()) rticonnextdds_connector.rticonnextdds_connector.Error: DDS Exception: DDS_DynamicDataParser_parse_json_node:!parse json node can DDS_DynamicDataFormatter_from_json_w_params:!parse json node RTILuaDynamicData_set_from_json:DDS_DynamicDataFormatter_from_json_w_params RTILuaMetamethodImpl_OutData:!set from JSON operation failed with retcode 3 RTI_Connector_set_json_instance:!set Failed to set JSON
Any idea how to get this to work serializing bytes?
Thanks,
AE
The text was updated successfully, but these errors were encountered: