From dc96af576365820d85d094536cee05a9a66b4207 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 9 May 2019 13:49:56 -0400 Subject: [PATCH] py3: textwrap.dedent requires unicode strings, encode after the fact Also all the format arguments are unicode strings, *and* in the wisdom of python3, you can % format a bytestring but not .format() it. --- src/calibre/ebooks/docx/writer/container.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/writer/container.py b/src/calibre/ebooks/docx/writer/container.py index 82ae0bd8f7..9dd894db8b 100644 --- a/src/calibre/ebooks/docx/writer/container.py +++ b/src/calibre/ebooks/docx/writer/container.py @@ -223,13 +223,13 @@ class DOCX(object): @property def containerrels(self): - return textwrap.dedent(b'''\ + return textwrap.dedent('''\ - '''.format(**self.namespace.names)) + '''.format(**self.namespace.names)).encode('utf-8') @property def websettings(self):