Issue 4833: Explicit directories for zipfiles
Created on 2009-01-04 17:09 by schuppenies, last changed 2022-04-11 14:56 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| test.zip | schmir, 2009-09-23 08:34 | |||
| sam_ezeh.patch | sam_ezeh, 2022-03-28 19:24 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 32160 | merged | sam_ezeh, 2022-03-28 19:21 | |
| Messages (6) | |||
|---|---|---|---|
| msg79070 - (view) | Author: Robert Schuppenies (schuppenies) * ![]() |
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) * ![]() |
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. |
|||
| msg416126 - (view) | Author: Sam Ezeh (sam_ezeh) * | Date: 2022-03-27 14:00 | |
I'm looking into adding ZipFile.mkdir |
|||
| msg416203 - (view) | Author: Sam Ezeh (sam_ezeh) * | Date: 2022-03-28 19:24 | |
I've submitted the above patch. I created the ZipFile.mkdir function, created the necessary tests and wrote the documentation. I think it is ready for review. |
|||
| msg416800 - (view) | Author: Ethan Furman (ethan.furman) * ![]() |
Date: 2022-04-05 18:41 | |
New changeset 050a8f94c678a05d506fe192c863c4a572178c42 by Sam Ezeh in branch 'main': bpo-4833: Add ZipFile.mkdir (GH-32160) https://github.com/python/cpython/commit/050a8f94c678a05d506fe192c863c4a572178c42 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:43 | admin | set | github: 49083 |
| 2022-04-05 18:41:41 | ethan.furman | set | messages: + msg416800 |
| 2022-04-02 21:29:07 | ethan.furman | set | nosy:
+ twouters, alanmcintyre |
| 2022-03-28 19:59:48 | ethan.furman | set | nosy:
+ ethan.furman versions: + Python 3.11, - Python 3.4 |
| 2022-03-28 19:24:22 | sam_ezeh | set | files:
+ sam_ezeh.patch messages: + msg416203 |
| 2022-03-28 19:21:18 | sam_ezeh | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request30238 |
| 2022-03-27 14:00:14 | sam_ezeh | set | messages: + msg416126 |
| 2022-03-27 13:42:54 | sam_ezeh | set | nosy:
+ sam_ezeh |
| 2012-12-03 17:47:17 | serhiy.storchaka | set | versions:
+ Python 3.4 nosy: + serhiy.storchaka messages: + msg176860 stage: needs patch |
| 2011-05-30 21:45:57 | Arfrever | set | nosy:
+ Arfrever |
| 2011-02-01 18:39:45 | thijs | set | nosy:
+ thijs |
| 2009-09-23 08:34:22 | schmir | set | files:
+ test.zip nosy: + schmir messages: + msg93031 |
| 2009-01-04 17:09:27 | schuppenies | create | |
