[ros-users] [Discourse.ros.org] [Client Libraries] Python3 and strings

Asmodehn ros.discourse at gmail.com
Fri Aug 11 07:17:49 UTC 2017



But `str` in Python3 is `unicode` in Python2, and having different ways to serialize data between different versions of python will break a few things in many places ("why my message is garbled on this node and not that one?").
We could do that, but it would require a "big warning" everywhere we mention this topic...

=> I **could not find any REP** specification regarding the message serialization, and how to match the types of the supported languages and integrate deserialization with it. I seems it's something we need to drive implementation (especially given ROS supports multiple languages) and prevent "incomplete features" as much as possible.

The current serialization code **breaks** :
- when we pass a `bytes` in python 3 (no `encode` method) fix attempt [here](https://github.com/ros/genpy/pull/85/files)
- when we pass a `unicode` in python2 (receiving end lose the encoding)
- when we pass a `str` in python3 (receiving python2 end lose the encoding)

=> we need a solution (design fix) that integrates properly for all supported languages...





---
[Visit Topic](https://discourse.ros.org/t/python3-and-strings/2392/7) or reply to this email to respond.




More information about the ros-users mailing list