[issue30213] ZipFile from 'a'ppend-mode file generates invalid zip

Serhiy Storchaka report at bugs.python.org
Mon Dec 4 02:29:43 EST 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

The problem is that seek() doesn't work properly with files opened in append mode.

with open('file', 'ab') as f:
    f.write(b'abcd')
    f.seek(0)
    f.write(b'efgh')
    f.flush()

with open('file', 'rb') as f:
    print(f.read())

The result is b'abcdefgh' instead of expected b'efgh'.

----------
resolution: duplicate -> 
stage: resolved -> 
status: closed -> open
superseder: Regression in zipfile writing in 2.7.13 -> 

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30213>
_______________________________________


More information about the Python-bugs-list mailing list