[New-bugs-announce] [issue27055] python fails to run zipapp when zip contains comments

Dmitry report at bugs.python.org
Wed May 18 21:04:24 EDT 2016


New submission from Dmitry:

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

----------
files: attach.zip
messages: 265839
nosy: Denisov
priority: normal
severity: normal
status: open
title: python fails to run zipapp when zip contains comments
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file42894/attach.zip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27055>
_______________________________________


More information about the New-bugs-announce mailing list