From 9efcc37f16c36f61b706e27e8b2c435f6a5cae36 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 Jul 2021 17:12:29 +0530 Subject: [PATCH] TXT Input: Dont fail if the txt file references a directory as a resosource. Fixes #1936184 [Txt conversion => azw3 failed](https://bugs.launchpad.net/calibre/+bug/1936184) --- src/calibre/ebooks/conversion/plugins/txt_input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plugins/txt_input.py b/src/calibre/ebooks/conversion/plugins/txt_input.py index dd2b82cfde..82fae5d53e 100644 --- a/src/calibre/ebooks/conversion/plugins/txt_input.py +++ b/src/calibre/ebooks/conversion/plugins/txt_input.py @@ -116,7 +116,7 @@ class TXTInput(InputFormatPlugin): prefix = src.split(':', 1)[0].lower() if prefix not in ('file', 'http', 'https', 'ftp') and not os.path.isabs(src): src = os.path.join(base_dir, src) - if os.access(src, os.R_OK): + if os.path.isfile(src) and os.access(src, os.R_OK): with open(src, 'rb') as f: data = f.read() f = self.shift_file(os.path.basename(src), data)