This issue tracker will soon become read-only and move to GitHub.
For a smoother transition, remember to log in and link your GitHub username to your profile.
For more information, see this post about the migration.

classification
Title: Explicit directories for zipfiles
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, schmir, schuppenies, serhiy.storchaka, thijs
Priority: normal Keywords:

Created on 2009-01-04 17:09 by schuppenies, last changed 2012-12-03 17:47 by serhiy.storchaka.

Files
File name Uploaded Description Edit
test.zip schmir, 2009-09-23 08:34
Messages (3)
msg79070 - (view) Author: Robert Schuppenies (schuppenies) * (Python committer) Date: 2009-01-04 17:09
We have an issue with the Python cheeseshop which is probably an issue
with Python itself as well.

When we create a zip file with standard linux tools ('zip os-zipped.zip
*'), uploading it works fine. But if we use the zipfile module from
Python and try to upload the result to the cheeseshop, we get this error
message:

" Error unpacking zipfile:[Errno 2] No such file or directory: 
u'/data/packagedocs/Pympler/_sources/index.txt'"

Turns out that the Python-zipped version does not include explicit
directories. The OS-zipped version contains "directory/,
directory/asizeof.txt", the Python-zipped file only
"directory/asizeof.txt". Digging deeper, Python has no way to explicitly
add directories to a zip file.

It would be useful to have an option which allows the explicit creation
of directories inside of zip files. This would help when working with
applications which do not create directories if they are not explicitly
specified.
msg93031 - (view) Author: Ralf Schmitt (schmir) Date: 2009-09-23 08:34
it looks like this is fixed in 2.6.2.

I'm attaching a zipfile which cannot be extracted in 2.6.1

Running
python -c 'import zipfile; zipfile.ZipFile("test.zip").extractall()'
in 2.6.2 however works. 
but you should not do that anyway because of issue 6972
msg176860 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-03 17:47
Actually now creating directories in zipfile is possible with ZipFile.writestr(special_zip_info, b''). However a special method (like ZipFile.mkdir(name)) can be useful.
History
Date User Action Args
2012-12-03 17:47:17serhiy.storchakasetversions: + Python 3.4
nosy: + serhiy.storchaka

messages: + msg176860

stage: needs patch
2011-05-30 21:45:57Arfreversetnosy: + Arfrever
2011-02-01 18:39:45thijssetnosy: + thijs
2009-09-23 08:34:22schmirsetfiles: + test.zip
nosy: + schmir
messages: + msg93031

2009-01-04 17:09:27schuppeniescreate