From c3aed85cbfb5215cab8cc38dd3b1018025836b4a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Jul 2021 21:35:25 +0530 Subject: [PATCH] fetch-ebook-metadata: Fix an error when using the --cover option and no cover is found. Fixes #1938189 [fetch-ebook-metadata sometimes fails with -c switch](https://bugs.launchpad.net/calibre/+bug/1938189) --- src/calibre/ebooks/metadata/sources/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/cli.py b/src/calibre/ebooks/metadata/sources/cli.py index 4b8271b437..1c3f505ec8 100644 --- a/src/calibre/ebooks/metadata/sources/cli.py +++ b/src/calibre/ebooks/metadata/sources/cli.py @@ -90,8 +90,9 @@ def main(args=sys.argv): if opts.cover and results: cover = download_cover(log, title=opts.title, authors=authors, identifiers=result.identifiers, timeout=int(opts.timeout)) - if cover is None and not opts.opf: - prints('No cover found', file=sys.stderr) + if cover is None: + if not opts.opf: + prints('No cover found', file=sys.stderr) else: save_cover_data_to(cover[-1], opts.cover) result.cover = cf = opts.cover