diff --git a/src/calibre/db/cli/cmd_list.py b/src/calibre/db/cli/cmd_list.py index a1afc96000..edd5712555 100644 --- a/src/calibre/db/cli/cmd_list.py +++ b/src/calibre/db/cli/cmd_list.py @@ -13,7 +13,7 @@ from calibre import prints from calibre.db.cli.utils import str_width from calibre.ebooks.metadata import authors_to_string from calibre.utils.date import isoformat -from polyglot.builtins import iteritems, unicode_type, map +from polyglot.builtins import as_bytes, iteritems, map, unicode_type readonly = True version = 0 # change this if you change signature of implementation() @@ -204,6 +204,7 @@ def do_list( with ColoredStream(sys.stdout, fg='green'): prints(''.join(titles)) stdout = getattr(sys.stdout, 'buffer', sys.stdout) + linesep = as_bytes(os.linesep) wrappers = [TextWrapper(x - 1).wrap if x > 1 else lambda y: y for x in widths] @@ -219,7 +220,7 @@ def do_list( if i < len(text) - 1: filler = ('%*s' % (widths[i] - str_width(ft) - 1, '')) stdout.write((filler + separator).encode('utf-8')) - stdout.write(b'\n') + stdout.write(linesep) def option_parser(get_parser, args):