From faae8466ac51b22a9b836103ce6e5c039dfc7eea Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 17 Dec 2013 20:17:17 +0000 Subject: Add --output-dir option --- mammoth/conversion.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'mammoth/conversion.py') diff --git a/mammoth/conversion.py b/mammoth/conversion.py index b324c16..835cb6b 100644 --- a/mammoth/conversion.py +++ b/mammoth/conversion.py @@ -73,11 +73,8 @@ class DocumentConverter(object): def _convert_image(self, image, html_generator): - image_bytes = image.open() - try: + with image.open() as image_bytes: encoded_src = base64.b64encode(image_bytes.read()).decode("ascii") - finally: - image_bytes.close() attributes = { "src": "data:{0};base64,{1}".format(image.content_type, encoded_src) -- cgit v1.2.3