From fb5bcfb4c1b39ea8e426f9c13a473ad235c8b38b Mon Sep 17 00:00:00 2001 From: Naoto Tsukamoto Date: Mon, 27 Mar 2023 08:44:24 +0900 Subject: [PATCH] fix python3 decode error in description and info in smach_to_mail.py --- .../jsk_robot_startup/scripts/smach_to_mail.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py b/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py index e892a383a1..2b1578cd67 100755 --- a/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py +++ b/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py @@ -175,7 +175,10 @@ def _send_mail(self, subject, state_list): if 'DESCRIPTION' in x: description = EmailBody() description.type = 'text' - description.message = x['DESCRIPTION'] + description_txt = x['DESCRIPTION'] + if isinstance(description_txt, bytes): + description_txt = description_txt.decode('utf-8') + description.message = description_txt email_msg.body.append(description) email_msg.body.append(changeline) if 'IMAGE' in x and x['IMAGE']: @@ -196,7 +199,10 @@ def _send_mail(self, subject, state_list): if 'INFO' in x: info = EmailBody() info.type = 'text' - info.message = x['INFO'] + info_txt = x['INFO'] + if isinstance(info_txt, bytes): + info_txt = info_txt.decode('utf-8') + info.message = info_txt email_msg.body.append(info) email_msg.body.append(changeline) # rospy.loginfo("body:{}".format(email_msg.body))