X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fmessage.py;h=d5b98e4fdfdf5ab19e41fcda61ce0fc57d7b301f;hb=6c6b0f13ffc3988b0f31774b33b8215be02abaa9;hp=fc177eb2b1557cb68c7c5c17bcedaf974b563869;hpb=07dff496304d6dc2e8033a18691b095ed9cd212f;p=notmuch diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index fc177eb2..d5b98e4f 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -41,6 +41,7 @@ from .tag import Tags from .filenames import Filenames import email +import sys class Message(Python3StringMixIn): @@ -566,7 +567,7 @@ class Message(Python3StringMixIn): logical OR operator.) As a convenience, you can set the sync_maildir_flags parameter in - :meth:`Database.add_message` to implicitly call this. + :meth:`Database.index_file` to implicitly call this. :returns: a :class:`STATUS`. In short, you want to see notmuch.STATUS.SUCCESS here. See there for details.""" @@ -587,8 +588,11 @@ class Message(Python3StringMixIn): def get_message_parts(self): """Output like notmuch show""" - fp = open(self.get_filename()) - email_msg = email.message_from_file(fp) + fp = open(self.get_filename(), 'rb') + if sys.version_info[0] < 3: + email_msg = email.message_from_file(fp) + else: + email_msg = email.message_from_binary_file(fp) fp.close() out = []