From 8078bf0931ddf9cf1e05f575c1b79ac710094113 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 9 Sep 2019 21:59:46 -0400 Subject: [PATCH] py3: etree.tostring emits bytes, and must be written using binary mode --- src/calibre/library/catalogs/csv_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/catalogs/csv_xml.py b/src/calibre/library/catalogs/csv_xml.py index 8576e3849b..1267a628ab 100644 --- a/src/calibre/library/catalogs/csv_xml.py +++ b/src/calibre/library/catalogs/csv_xml.py @@ -235,6 +235,6 @@ class CSV_XML(CatalogPlugin): if 'library_name' in fields: record.append(E.library_name(current_library)) - with open(path_to_output, 'w') as f: + with open(path_to_output, 'wb') as f: f.write(etree.tostring(root, encoding='utf-8', xml_declaration=True, pretty_print=True))