From 2847ed86f10c3ec10b172026ee15741302e28f83 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 22 Feb 2019 10:54:30 +0100 Subject: [PATCH] Fix bug --- awesome-wm-widgets/email-widget/read_unread_emails.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awesome-wm-widgets/email-widget/read_unread_emails.py b/awesome-wm-widgets/email-widget/read_unread_emails.py index b91ebde..1304cf2 100755 --- a/awesome-wm-widgets/email-widget/read_unread_emails.py +++ b/awesome-wm-widgets/email-widget/read_unread_emails.py @@ -27,15 +27,16 @@ def process_mailbox(mailbox, to = None): print("ERROR getting message", num) return False - msg = email.message_from_string(data[0][1].decode()) + msg = email.message_from_bytes(data[0][1]) if to is not None: print('To: ', to) print('From:', msg['From']) + subject = decode_mime_words(msg['Subject']) - print('Subject: %s' % decode_mime_words(msg['Subject'])) + print('Subject: %s' % subject) date_tuple = email.utils.parsedate_tz(msg['Date']) if date_tuple: local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))