ros-visualization / rqt_bag

http://wiki.ros.org/rqt_bag
31 stars 55 forks source link

TypeError: a bytes-like object is required, not 'str' #49

Closed jcremona closed 4 years ago

jcremona commented 4 years ago

Hi,

I have the following problem in ROS Noetic in Ubuntu 20.04, Python version is 3.8.2. I've tried to display raw IMU data on rqt_bag. After solving a bug as explained in #35, I get this error in raw_view.py script:

Traceback (most recent call last):
File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/message_view.py", line 93, in event
    self.message_viewed(bag, msg_data)
  File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 72, in message_viewed
    self.message_tree.set_message(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 111, in set_message
    self._add_msg_object(None, '', '', msg, msg._type)
  File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 240, in _add_msg_object
    self._add_msg_object(item, subpath, subobj_name, subobj, subobj_type)
  File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 240, in _add_msg_object
    self._add_msg_object(item, subpath, subobj_name, subobj, subobj_type)
  File "/opt/ros/noetic/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 208, in _add_msg_object
    obj_repr = codecs.utf_8_decode(str(obj), 'ignore')[0]
TypeError: a bytes-like object is required, not 'str'

In this case, type(obj) is str. Even though its type is not str, it is converted to str before passing to codecs.utf_8_decode. This error appears when trying to visualize IMU data from Rosario Dataset: https://www.cifasis-conicet.gov.ar/robot/doku.php