From 58e506d0cd4c8fd6440929298a448f9163817a09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Nov 2022 11:07:19 +0530 Subject: [PATCH] EPUB Input: Fix empty adobe page number template file causing conversion to fail. Fixes #1995551 [[Bug] Convert EPUB Fail (TypeError: cannot convert 'NoneType' object to bytes)](https://bugs.launchpad.net/calibre/+bug/1995551) --- src/calibre/ebooks/oeb/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 6c3bfd13ea..1761acefa5 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -432,7 +432,7 @@ def serialize(data, media_type, pretty_print=False): if isinstance(data, str): data = data.encode('utf-8') return data + b'\n' - return bytes(data) + return b'' if data is None else bytes(data) ASCII_CHARS = frozenset(codepoint_to_chr(x) for x in range(128))