Skip to content

Commit

Permalink
Merge pull request #1788 from knorth55/smach-to-mail-python3
Browse files Browse the repository at this point in the history
[jsk_robot_startup] fix python3 decode error in smach_to_mail
  • Loading branch information
k-okada authored Apr 10, 2023
2 parents 6743071 + fb5bcfb commit 9391924
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,20 @@ 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']:
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)
Expand All @@ -193,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))
Expand Down

0 comments on commit 9391924

Please sign in to comment.