displayable_path() wrap for config path logging

This commit is contained in:
Adrian Sampson 2012-01-27 12:27:53 -08:00
parent 4a1e8fdd6e
commit dfb0eff8e3
3 changed files with 7 additions and 3 deletions

View file

@ -702,9 +702,9 @@ def main(args=None, configfh=None):
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO)
log.debug(u'config file: %s' % configpath)
log.debug(u'library database: %s' % lib.path)
log.debug(u'library directory: %s' % lib.directory)
log.debug(u'config file: %s' % util.displayable_path(configpath))
log.debug(u'library database: %s' % util.displayable_path(lib.path))
log.debug(u'library directory: %s' % util.displayable_path(lib.directory))
# Invoke the subcommand.
try:

View file

@ -171,6 +171,9 @@ def displayable_path(path):
"""
if isinstance(path, unicode):
return path
elif not isinstance(path, str):
# A non-string object: just get its unicode representation.
return unicode(path)
encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
try:

View file

@ -16,6 +16,7 @@ Changelog
a single field.
* Fix a crash with non-ASCII characters in bytestring metadata fields (e.g.,
MusicBrainz IDs).
* Fix another crash with non-ASCII characters in the configuration paths.
1.0b12 (January 16, 2012)