From cd2c4e8a8ee25c73e9e8cadbd4b11e4100f2e03a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 6 Sep 2017 20:11:46 +0100 Subject: Use "with" to open file in example --- recipes/wmf_images.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'recipes') diff --git a/recipes/wmf_images.py b/recipes/wmf_images.py index 3b38bce..5fb3fe1 100644 --- a/recipes/wmf_images.py +++ b/recipes/wmf_images.py @@ -21,9 +21,8 @@ import tempfile # image = libreoffice_wmf_conversion(image, post_process=imagemagick_trim) # return mammoth.images.data_uri(image) # -# -# fileobj = open("document.docx", "rb") -# result = mammoth.convert_to_html(fileobj, convert_image=convert_image) +# with open("document.docx", "rb") as fileobj: +# result = mammoth.convert_to_html(fileobj, convert_image=convert_image) _wmf_extensions = { -- cgit v1.2.3