Skip to content

Commit

Permalink
fix python3 decode error in description and info in smach_to_mail.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmtnt7000 authored and knorth55 committed Mar 27, 2023
1 parent 4856044 commit fb5bcfb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 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,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']:
Expand All @@ -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))
Expand Down

0 comments on commit fb5bcfb

Please sign in to comment.