From b42444d38b7f801c883c209772d4af82422ec380 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Sun, 17 Jan 2016 17:09:39 +0800 Subject: [PATCH] [utils] I18N: fix for Python 2.6 Using zipfile directly as a context manager is not supported until Python 2.7 --- youtube_dl/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 9628a8339..8f643d52f 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2541,7 +2541,7 @@ class I18N(object): except KeyError: zinfo = None if zinfo is not None: - with zipf.open(zinfo) as mo_file: + with contextlib.closing(zipf.open(zinfo)) as mo_file: t = gettext.GNUTranslations(mo_file) zipf.close() return t