Skip to content

Commit f0901fb

Browse files
committed
Remove ZipFile support for Python 2.6
See #14576 (comment)
1 parent 2c78178 commit f0901fb

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
@@ -276,17 +275,6 @@ def file_path_to_url(path):
276275
return urljoin('file:', pathname2url(path))
277276

278277

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

331319
# ZIP Compression
332320
elif compression == 'zip':
321+
import zipfile
333322
zip_file = zipfile.ZipFile(source)
334323
try:
335324
name, = zip_file.namelist()

0 commit comments

Comments
 (0)