mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #1864340 [calibredb list output to file is broken](https://bugs.launchpad.net/calibre/+bug/1864340)
py3 apparently cant print newlines correctly when stdout is redirected to a file. Sigh.
This commit is contained in:
parent
6290903cbf
commit
a41fcfd3db
@ -214,12 +214,12 @@ def do_list(
|
|||||||
lines = max(map(len, text))
|
lines = max(map(len, text))
|
||||||
for l in range(lines):
|
for l in range(lines):
|
||||||
for i, field in enumerate(text):
|
for i, field in enumerate(text):
|
||||||
ft = text[i][l] if l < len(text[i]) else u''
|
ft = text[i][l] if l < len(text[i]) else ''
|
||||||
stdout.write(ft.encode('utf-8'))
|
stdout.write(ft.encode('utf-8'))
|
||||||
if i < len(text) - 1:
|
if i < len(text) - 1:
|
||||||
filler = (u'%*s' % (widths[i] - str_width(ft) - 1, u''))
|
filler = ('%*s' % (widths[i] - str_width(ft) - 1, ''))
|
||||||
stdout.write((filler + separator).encode('utf-8'))
|
stdout.write((filler + separator).encode('utf-8'))
|
||||||
print()
|
stdout.write(b'\n')
|
||||||
|
|
||||||
|
|
||||||
def option_parser(get_parser, args):
|
def option_parser(get_parser, args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user