diff --git a/mopidy/utils/path.py b/mopidy/utils/path.py index 6bd84ac0..78377891 100644 --- a/mopidy/utils/path.py +++ b/mopidy/utils/path.py @@ -48,12 +48,14 @@ def split_path(path): def find_files(path): path = os.path.expanduser(path) if os.path.isfile(path): - yield os.path.abspath(path) + filename = os.path.abspath(path) + yield filename.decode('utf-8') else: for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: dirpath = os.path.abspath(dirpath) - yield os.path.join(dirpath, filename) + filename = os.path.join(dirpath, filename) + yield filename.decode('utf-8') class Mtime(object): def __init__(self): diff --git a/tests/utils/path_test.py b/tests/utils/path_test.py index 065cde5d..758a09ab 100644 --- a/tests/utils/path_test.py +++ b/tests/utils/path_test.py @@ -133,6 +133,12 @@ class FindFilesTest(unittest.TestCase): self.assertEqual(len(files), 1) self.assert_(files[0], data_folder('blank.mp3')) + def test_names_are_unicode(self): + is_unicode = lambda f: isinstance(f, unicode) + for name in self.find(''): + self.assert_(is_unicode(name), + '%s is not unicode object' % repr(name)) + def test_expanduser(self): raise SkipTest