This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Zip files created by `git archive` result in a SyntaxError (due to comment?)
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.4, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Make zipimport work with zipfile containing comments
View: 5950
Assigned To: Nosy List: lekensteyn, r.david.murray
Priority: normal Keywords:

Created on 2014-09-01 15:11 by lekensteyn, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg226230 - (view) Author: Peter Wu (lekensteyn) Date: 2014-09-01 15:11
Files created by `git archive` are not understood by the Python interpreter. This could be caused by the additional comment (for the commit hash) in the file.

echo 'print(1)' > __main__.py
git init && git add __main__.py && git commit -m init
git archive --format=zip HEAD > y.zip
python y.zip

Packing it with `zip x.zip __main__.py && python x.zip` works.
msg226233 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-09-01 16:26
You are correct. zipimport does not support zip files with comments.  There is already an open issue (issue 5950) for adding support for this.
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66518
2014-09-01 16:26:14r.david.murraysetstatus: open -> closed

superseder: Make zipimport work with zipfile containing comments

nosy: + r.david.murray
messages: + msg226233
resolution: duplicate
stage: resolved
2014-09-01 15:11:58lekensteyncreate