diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-17 20:17:17 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-17 20:17:17 +0000 |
| commit | faae8466ac51b22a9b836103ce6e5c039dfc7eea (patch) | |
| tree | d746a9cf81abefc626c651756367c97dbbeb77bf /mammoth/conversion.py | |
| parent | a2d5ef8d5590bfb7d7b038d7753b8d8b2b013ecd (diff) | |
Add --output-dir option
Diffstat (limited to 'mammoth/conversion.py')
| -rw-r--r-- | mammoth/conversion.py | 5 |
1 files changed, 1 insertions, 4 deletions
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) |
