From 81b32804c7b47ef24bf8a3a29a7e16c8f542db81 Mon Sep 17 00:00:00 2001 From: Manuel Guenther <manuel.guenther@idiap.ch> Date: Fri, 7 Nov 2014 19:05:10 +0100 Subject: [PATCH] Hopefully fixed bug in python 2.6 --- bob/buildout/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bob/buildout/tools.py b/bob/buildout/tools.py index 1a3b85e..4a85350 100644 --- a/bob/buildout/tools.py +++ b/bob/buildout/tools.py @@ -94,12 +94,17 @@ def zipfile_readlines(package, filename): import zipfile - with zipfile.ZipFile(package) as f: + f = None + try: + f = zipfile.ZipFile(package) try: package_dir = os.path.splitext(os.path.basename(package))[0] return [line.decode('utf-8') if isinstance(line, bytes) else line for line in f.open(os.path.join(package_dir, filename), 'rU').readlines()] except: pass + finally: + if f is not None: + f.close() return [] -- GitLab