From dfb0eff8e3d1296f4d9559f9b7abe8712f4f4db1 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 27 Jan 2012 12:27:53 -0800 Subject: [PATCH] displayable_path() wrap for config path logging --- beets/ui/__init__.py | 6 +++--- beets/util/__init__.py | 3 +++ docs/changelog.rst | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 022fc00d4..79c4d562c 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -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: diff --git a/beets/util/__init__.py b/beets/util/__init__.py index bc19c1620..6f67aad4b 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -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: diff --git a/docs/changelog.rst b/docs/changelog.rst index b10819e01..66b9547bd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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)