From 2e608ed1791b19fcf19fbf56e2d3fbf641173104 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 4 Feb 2014 17:32:32 +0530 Subject: [PATCH] calibredb list: Fix error if one of the requested fields if empty for all requested books --- src/calibre/library/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index 662a83c2e7..08775a9138 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -131,11 +131,11 @@ def do_list(db, fields, afields, sort_by, ascending, search_text, line_width, se with ColoredStream(sys.stdout, fg='green'): print ''.join(titles) - wrappers = map(lambda x: TextWrapper(x-1), widths) + wrappers = [TextWrapper(x - 1).wrap if x > 1 else lambda y: y for x in widths] o = cStringIO.StringIO() for record in data: - text = [wrappers[i].wrap(unicode(record[field])) for i, field in enumerate(fields)] + text = [wrappers[i](unicode(record[field])) for i, field in enumerate(fields)] lines = max(map(len, text)) for l in range(lines): for i, field in enumerate(text):