From 99cb0c4417951517e03e1566a168700ad4ea7129 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 25 Apr 2019 03:01:15 -0400 Subject: [PATCH 1/2] py3: make conversion in the GUI work --- src/calibre/gui2/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index e2136cf0ed..4ee5e9bb2a 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -60,7 +60,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ index_is_id=True) out_file = PersistentTemporaryFile('.' + d.output_format) - out_file.write(d.output_format) + out_file.write(d.output_format.encode('utf-8')) out_file.close() temp_files = [in_file] From 2663085c5518d990527837c21e24078241439647 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 25 Apr 2019 03:32:21 -0400 Subject: [PATCH 2/2] py3: don't unpack dict before passing it to new defaultdict constructor This was never needed, but it breaks on python3 since e.g. None cannot be a keyword. defaultdict can just accept the dict itself, though. --- src/calibre/ebooks/oeb/transforms/split.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 65fdb91698..24a77fe0e6 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -76,7 +76,7 @@ class Split(object): if splitter.was_split: am = splitter.anchor_map self.map[item.href] = collections.defaultdict( - am.default_factory, **am) + am.default_factory, am) def find_page_breaks(self, item): if self.page_break_selectors is None: