mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 07:53:09 +02:00
Fix #801791 (Search RegExp Wizard fails on all LIT files in 0.8.7)
This commit is contained in:
parent
f92aa96a4e
commit
7641b92166
1 changed files with 6 additions and 2 deletions
|
|
@ -139,7 +139,10 @@ def select_format(self, db, book_id):
|
|||
try:
|
||||
self.open_book(fpath)
|
||||
finally:
|
||||
os.remove(fpath)
|
||||
try:
|
||||
os.remove(fpath)
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
|
||||
def open_book(self, pathtoebook):
|
||||
|
|
@ -148,7 +151,8 @@ def open_book(self, pathtoebook):
|
|||
text = [u'']
|
||||
preprocessor = HTMLPreProcessor(None, False)
|
||||
for path in self.iterator.spine:
|
||||
html = open(path, 'rb').read().decode('utf-8', 'replace')
|
||||
with open(path, 'rb') as f:
|
||||
html = f.read().decode('utf-8', 'replace')
|
||||
html = preprocessor(html, get_preprocess_html=True)
|
||||
text.append(html)
|
||||
self.preview.setPlainText('\n---\n'.join(text))
|
||||
|
|
|
|||
Loading…
Reference in a new issue