diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 4e4435e16..7e94bddeb 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2547,8 +2547,13 @@ class I18N(object): locale_data_zip = _load_exe_resource('LOCALE_DATA', 'LOCALE_DATA.ZIP') f = io.BytesIO(locale_data_zip) zipf = zipfile.ZipFile(f) - with zipf.open('share/locale/%s/LC_MESSAGES/%s.mo' % (lang, self.domain)) as mo_file: - t = gettext.GNUTranslations(mo_file) + try: + zinfo = zipf.getinfo('share/locale/%s/LC_MESSAGES/%s.mo' % (lang, self.domain)) + except KeyError: + zinfo = None + if zinfo is not None: + with zipf.open(zinfo) as mo_file: + t = gettext.GNUTranslations(mo_file) zipf.close() if t is None: