From d9c22e7e1cf96f408f7cb87b9f2b9f9fe9848c17 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 22 Apr 2019 08:38:56 +0530 Subject: [PATCH] py3: misc fixes --- src/calibre/ebooks/conversion/plumber.py | 2 +- src/calibre/ebooks/html/input.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 5d8e46fd67..2b532cc0e0 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -1062,7 +1062,7 @@ OptionRecommendation(name='search_replace', if not os.path.exists(self.opts.debug_pipeline): os.makedirs(self.opts.debug_pipeline) open(os.path.join(self.opts.debug_pipeline, 'README.txt'), - 'w').write(DEBUG_README.encode('utf-8')) + 'wb').write(DEBUG_README.encode('utf-8')) for x in ('input', 'parsed', 'structure', 'processed'): x = os.path.join(self.opts.debug_pipeline, x) if os.path.exists(x): diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index c5f7dcca4b..1b4d644cd2 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -145,6 +145,9 @@ class HTMLFile(object): def __eq__(self, other): return self.path == getattr(other, 'path', other) + def __hash__(self): + return hash(self.path) + def __str__(self): return u'HTMLFile:%d:%s:%s'%(self.level, 'b' if self.is_binary else 'a', self.path)