From 889b29b530f15fbf322634889db137c79b894d6a Mon Sep 17 00:00:00 2001 From: sigma67 Date: Thu, 22 Sep 2022 18:07:26 +0200 Subject: [PATCH] fix language exception error message --- ytmusicapi/ytmusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ytmusicapi/ytmusic.py b/ytmusicapi/ytmusic.py index fef8199..80b8c93 100644 --- a/ytmusicapi/ytmusic.py +++ b/ytmusicapi/ytmusic.py @@ -102,10 +102,10 @@ class YTMusic(BrowsingMixin, SearchMixin, WatchMixin, ExploreMixin, LibraryMixin self.context = initialize_context() self.context['context']['client']['hl'] = language locale_dir = os.path.abspath(os.path.dirname(__file__)) + os.sep + 'locales' - supported_languages = [f for f in os.listdir(locale_dir)] + supported_languages = [f for f in next(os.walk(locale_dir))[1]] if language not in supported_languages: - raise Exception("Language not supported. Supported languages are " - ', '.join(supported_languages)) + raise Exception("Language not supported. Supported languages are " + + (', '.join(supported_languages)) + ".") self.language = language try: locale.setlocale(locale.LC_ALL, self.language)