Skip to content

Commit df21418

Browse files
committed
Allow loading of zipfiles that contain __MACOSX and .DS_STORE hidden folders
1 parent 9cb3723 commit df21418

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/io/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,12 @@ def get_handle(
564564
if zf.mode == "w":
565565
f = zf
566566
elif zf.mode == "r":
567-
zip_names = zf.namelist()
567+
# Ignore hidden folders added by OS X/macOS on .zip creation
568+
zip_names = [
569+
_
570+
for _ in zf.namelist()
571+
if not (_.startswith("__MACOSX/") or _.startswith(".DS_STORE"))
572+
]
568573
if len(zip_names) == 1:
569574
f = zf.open(zip_names.pop())
570575
elif len(zip_names) == 0:

0 commit comments

Comments
 (0)