Skip to content

Commit 28f19f1

Browse files
committed
Remove ZipFile support for Python 2.6
See #14576 (comment)
1 parent 4986346 commit 28f19f1

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pandas/io/common.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import csv
66
import codecs
77
import mmap
8-
import zipfile
98
from contextlib import contextmanager, closing
109

1110
from pandas.compat import StringIO, BytesIO, string_types, text_type
@@ -274,17 +273,6 @@ def file_path_to_url(path):
274273
return urljoin('file:', pathname2url(path))
275274

276275

277-
# ZipFile is not a context manager for <= 2.6
278-
# must be tuple index here since 2.6 doesn't use namedtuple for version_info
279-
if compat.PY2 and sys.version_info[1] <= 6:
280-
@contextmanager
281-
def ZipFile(*args, **kwargs):
282-
with closing(zipfile.ZipFile(*args, **kwargs)) as zf:
283-
yield zf
284-
else:
285-
ZipFile = zipfile.ZipFile
286-
287-
288276
def _get_handle(source, mode, encoding=None, compression=None,
289277
memory_map=False):
290278
"""
@@ -328,6 +316,7 @@ def _get_handle(source, mode, encoding=None, compression=None,
328316

329317
# ZIP Compression
330318
elif compression == 'zip':
319+
import zipfile
331320
zip_file = zipfile.ZipFile(source)
332321
try:
333322
name, = zip_file.namelist()

0 commit comments

Comments
 (0)