From 7de5b6e166dc2a7cc162b33cdcc00794a80da940 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 1 Jun 2011 19:28:36 -0600 Subject: [PATCH] ... --- src/calibre/gui2/actions/convert.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/actions/convert.py b/src/calibre/gui2/actions/convert.py index ed0a064e88..17fa0ad622 100644 --- a/src/calibre/gui2/actions/convert.py +++ b/src/calibre/gui2/actions/convert.py @@ -171,10 +171,9 @@ class ConvertAction(InterfaceAction): raise Exception(_('Empty output file, ' 'probably the conversion process crashed')) - data = open(temp_files[-1].name, 'rb') - self.gui.library_view.model().db.add_format(book_id, \ + with open(temp_files[-1].name, 'rb') as data: + self.gui.library_view.model().db.add_format(book_id, \ fmt, data, index_is_id=True) - data.close() self.gui.status_bar.show_message(job.description + \ (' completed'), 2000) finally: