mirror of
https://github.com/beetbox/beets.git
synced 2025-12-23 09:03:49 +01:00
let print_ take multiple arguments (just like print) -- thanks, Marty!
This commit is contained in:
parent
9aa13312d3
commit
3874afbaf8
1 changed files with 6 additions and 1 deletions
|
|
@ -41,11 +41,16 @@ class UserError(Exception):
|
|||
|
||||
# Utilities.
|
||||
|
||||
def print_(txt=''):
|
||||
def print_(*strings):
|
||||
"""Like print, but rather than raising an error when a character
|
||||
is not in the terminal's encoding's character set, just silently
|
||||
replaces it.
|
||||
"""
|
||||
if strings:
|
||||
if isinstance(strings[0], unicode):
|
||||
txt = u' '.join(strings)
|
||||
else:
|
||||
txt = ' '.join(strings)
|
||||
if isinstance(txt, unicode):
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
txt = txt.encode(encoding, 'replace')
|
||||
|
|
|
|||
Loading…
Reference in a new issue