mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #801791 (Search RegExp Wizard fails on all LIT files in 0.8.7)
This commit is contained in:
parent
f92aa96a4e
commit
7641b92166
@ -139,7 +139,10 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
||||
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 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
||||
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…
x
Reference in New Issue
Block a user