mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix prints()
This commit is contained in:
parent
86ffa4f717
commit
4775fc780c
@ -158,9 +158,13 @@ def prints(*args, **kwargs):
|
|||||||
'''
|
'''
|
||||||
file = kwargs.get('file', sys.stdout)
|
file = kwargs.get('file', sys.stdout)
|
||||||
file = getattr(file, 'buffer', file)
|
file = getattr(file, 'buffer', file)
|
||||||
sep = bytes(kwargs.get('sep', ' '))
|
|
||||||
end = bytes(kwargs.get('end', '\n'))
|
|
||||||
enc = 'utf-8' if 'CALIBRE_WORKER' in os.environ else preferred_encoding
|
enc = 'utf-8' if 'CALIBRE_WORKER' in os.environ else preferred_encoding
|
||||||
|
sep = kwargs.get('sep', ' ')
|
||||||
|
if not isinstance(sep, bytes):
|
||||||
|
sep = sep.encode(enc)
|
||||||
|
end = kwargs.get('end', '\n')
|
||||||
|
if not isinstance(end, bytes):
|
||||||
|
end = end.encode(enc)
|
||||||
safe_encode = kwargs.get('safe_encode', False)
|
safe_encode = kwargs.get('safe_encode', False)
|
||||||
count = 0
|
count = 0
|
||||||
for i, arg in enumerate(args):
|
for i, arg in enumerate(args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user