Skip to content

Commit

Permalink
remove pkg_resources (closes #223, #224)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Aug 26, 2021
1 parent 9d9d747 commit 013a1bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ytmusicapi/ytmusic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import requests
import gettext
import pkg_resources
import os
from contextlib import suppress
from typing import Dict
Expand Down Expand Up @@ -90,7 +89,8 @@ def __init__(self,
# prepare context
self.context = initialize_context()
self.context['context']['client']['hl'] = language
supported_languages = [f for f in pkg_resources.resource_listdir('ytmusicapi', 'locales')]
locale_dir = os.path.abspath(os.path.dirname(__file__)) + os.sep + 'locales'
supported_languages = [f for f in os.listdir(locale_dir)]
if language not in supported_languages:
raise Exception("Language not supported. Supported languages are "
', '.join(supported_languages))
Expand All @@ -101,8 +101,7 @@ def __init__(self,
with suppress(locale.Error):
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
self.lang = gettext.translation('base',
localedir=pkg_resources.resource_filename(
'ytmusicapi', 'locales'),
localedir=locale_dir,
languages=[language])
self.parser = browsing.Parser(self.lang)

Expand Down

0 comments on commit 013a1bf

Please sign in to comment.