From 9b46b4ab76c3e8ad673e20f6ea15d53c2c581a8f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Aug 2021 19:06:46 +0530 Subject: [PATCH] TXT Output: Fix max line length option not working py3 regression. Fixes #1941992 [TXT Output crashes when --max-line-length option is set](https://bugs.launchpad.net/calibre/+bug/1941992) --- src/calibre/ebooks/txt/txtml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/txt/txtml.py b/src/calibre/ebooks/txt/txtml.py index a6bdd91226..f70a011e2d 100644 --- a/src/calibre/ebooks/txt/txtml.py +++ b/src/calibre/ebooks/txt/txtml.py @@ -150,8 +150,8 @@ class TXTMLizer(object): text = re.sub(r'(?u)^[ \n]+', '', text) if self.opts.max_line_length: - max_length = self.opts.max_line_length - if self.opts.max_line_length < 25 and not self.opts.force_max_line_length: + max_length = int(self.opts.max_line_length) + if max_length < 25 and not self.opts.force_max_line_length: max_length = 25 short_lines = [] lines = text.splitlines()