ros-visualization / rqt_graph

http://wiki.ros.org/rqt_graph
27 stars 27 forks source link

Galactic TypeError on save to DOT file #67

Closed russkel closed 2 years ago

russkel commented 3 years ago

I just click Save as DOT graph when there is two nodes and a handful of edges on the display.

ros-galactic-rqt-graph/now 1.2.0-2focal.20210521.025816 amd64 [installed,local]

Traceback (most recent call last):
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_graph/ros_graph.py", line 416, in _save_dot
    handle.write(self._current_dotcode)
TypeError: write(self, Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type 'str'
RobinBaruffa commented 3 years ago

I have the same problem using noetic :

Traceback (most recent call last): File "/opt/ros/noetic/lib/python3/dist-packages/rqt_graph/ros_graph.py", line 414, in _save_dot handle.write(self._current_dotcode) TypeError: write(self, Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type 'str'

stklik commented 2 years ago

FWIW, a hacky quick fix that worked for me: Change the line that writes the data (see below) to handle.write(bytes(self._current_dotcode, 'utf-8'))

https://github.com/ros-visualization/rqt_graph/blob/60e4fa87e8490e71e3dc4a953b2c28914867aaec/src/rqt_graph/ros_graph.py#L414

russkel commented 2 years ago

PR #62 looks like it will fix this.

russkel commented 2 years ago

62 was merged.