Skip to content

Commit

Permalink
Fix rtfparse imports broken by rtfparse 0.9.0 and add shebang to top …
Browse files Browse the repository at this point in the history
…of outlookmsgfile.py (#27)

Co-authored-by: Alan Berezin <alan.berezin1.gmail.com>
  • Loading branch information
aberezin authored Apr 7, 2024
1 parent 8175fe3 commit e9a4516
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions outlookmsgfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env python

# This module converts a Microsoft Outlook .msg file into
# a MIME message that can be loaded by most email programs
# or inspected in a text editor.
Expand Down Expand Up @@ -25,7 +27,7 @@

import compoundfiles
from rtfparse.parser import Rtf_Parser
from rtfparse.renderers.de_encapsulate_html import De_encapsulate_HTML
from rtfparse.renderers.html_decapsulator import HTML_Decapsulator
import html2text

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -129,7 +131,7 @@ def load_message_stream(entry, is_top_level, doc):
rtf_blob = io.BytesIO(rtf)
parsed = Rtf_Parser(rtf_file=rtf_blob).parse_file()
html_stream = io.StringIO()
De_encapsulate_HTML().render(parsed, html_stream)
HTML_Decapsulator().render(parsed, html_stream)
html_body = html_stream.getvalue()

if not has_body:
Expand Down

0 comments on commit e9a4516

Please sign in to comment.