From 4856044cc9286ec10f90a4c9ce4c8c986e2dc7a2 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Mon, 27 Mar 2023 01:04:52 +0900 Subject: [PATCH 1/2] fix python3 decode error in smach_to_mail --- jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 dee5af4b08..e892a383a1 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 @@ -182,7 +182,10 @@ def _send_mail(self, subject, state_list): image = EmailBody() image.type = 'img' image.img_size = 100 - image.img_data = x['IMAGE'] + img_txt = x['IMAGE'] + if isinstance(img_txt, bytes): + img_txt = img_txt.decode('utf-8') + image.img_data = img_txt email_msg.body.append(image) email_msg.body.append(changeline) email_msg.body.append(changeline) From fb5bcfb4c1b39ea8e426f9c13a473ad235c8b38b Mon Sep 17 00:00:00 2001 From: Naoto Tsukamoto Date: Mon, 27 Mar 2023 08:44:24 +0900 Subject: [PATCH 2/2] 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))