From f2bfaf8be3c8da93bea4555056662d753d5a3495 Mon Sep 17 00:00:00 2001 From: Dmitriy Kasyanov Date: Wed, 13 Dec 2017 23:21:24 +0200 Subject: [PATCH] Fix AttributeError: __exit__ on Python 2.6 Error occurs while dealing with Tar archives --- tools/configure.d/nodedownload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure.d/nodedownload.py b/tools/configure.d/nodedownload.py index 5cf8e0dbd690e1..3f4bc090f71bdd 100644 --- a/tools/configure.d/nodedownload.py +++ b/tools/configure.d/nodedownload.py @@ -60,7 +60,7 @@ def unpack(packedfile, parent_path): icuzip.extractall(parent_path) return parent_path elif tarfile.is_tarfile(packedfile): - with tarfile.TarFile.open(packedfile, 'r') as icuzip: + with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip: print ' Extracting tarfile: %s' % packedfile icuzip.extractall(parent_path) return parent_path