jsk-ros-pkg / jsk_3rdparty

42 stars 60 forks source link

[switchbot_ros]force to use python3 for lambda string sort #495

Closed mqcmd196 closed 10 months ago

mqcmd196 commented 10 months ago

Current code dies with python UnicodeEncodeError

[switchbot_ros-1] restarting process
process[switchbot_ros-1]: started with pid [9793]
[INFO] [WallTime: 1698028051.518458] [node:/switchbot_ros] [func:SwitchBotAction.get_switchbot_client]: Switchbot API Client initialized.
Traceback (most recent call last):
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 121, in <module>
    server = SwitchBotAction()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 31, in __init__
    self.print_devices()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 66, in print_devices
    key=lambda device: str(device['deviceName']))
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 66, in <lambda>
    key=lambda device: str(device['deviceName']))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
[switchbot_ros-1] process has died [pid 9793, exit code 1, cmd /home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py __name:=switchbot_ros __log:=/home/fetch/.ros/log/cb16f396-7146-11ee-827c-c9d2ce386b33/switchbot_ros-1.log].
log file: /home/fetch/.ros/log/cb16f396-7146-11ee-827c-c9d2ce386b33/switchbot_ros-1*.log

This PR forces to use python3

mqcmd196 commented 10 months ago

The PR is tested on real robot (Fetch1075: melodic) and my PC (noetic)

mqcmd196 commented 10 months ago

If this PR is merged, I will handle https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/491 rebasing this PR

sktometometo commented 10 months ago

Great PR! I have left a comment.