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: python fails to run zipapp when zip contains comments
Type: crash Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Make zipimport work with zipfile containing comments
View: 5950
Assigned To: Nosy List: serhiy.storchaka, zaz600
Priority: normal Keywords:

Created on 2016-05-19 01:04 by zaz600, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
attach.zip zaz600, 2016-05-19 01:04 bad and good zips
Messages (2)
msg265839 - (view) Author: zaz600 (zaz600) Date: 2016-05-19 01:04
python fails to run zipapp when zip contains comments
when zip archive downloaded from github it contains tip hash in comment. 

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32

example:

```
import zipfile


if __name__ == '__main__':
    with open('__main__.py', "w") as m:
      m.write("print('hello')")
    

    zipf = zipfile.ZipFile('zipapp_bad.zip', 'w', zipfile.ZIP_DEFLATED)
    #add zip comment
    zipf.comment=b"123321"
    zipf.write("__main__.py")
    zipf.close()

    zipf = zipfile.ZipFile('zipapp_good.zip', 'w', zipfile.ZIP_DEFLATED)
    zipf.write("__main__.py")
    zipf.close()
```

D:\pywork\zip>python zipapp_good.zip
hello

D:\pywork\zip>python zipapp_bad.zip
  File "zipapp_bad.zip", line 1
    PK♥♦¶
      ^
SyntaxError: invalid syntax
msg265848 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-19 05:53
This is a duplicate of issue5950.
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71242
2016-05-19 05:53:05serhiy.storchakasetstatus: open -> closed

superseder: Make zipimport work with zipfile containing comments

nosy: + serhiy.storchaka
messages: + msg265848
resolution: duplicate
stage: resolved
2016-05-19 01:04:24zaz600create