def readable_zipfile(path): # zipfile.ZipFile() isn't a context manager under Python 2. zf = zipfile.ZipFile(path, 'r') try: yield zf finally: zf.close()