[issue22651] Open file in a+ mode reads from end of file in Python 3.4
STINNER Victor
report at bugs.python.org
Thu Jan 26 03:08:35 EST 2017
STINNER Victor added the comment:
On Python 2, it's easy to workaround the issue, just always go the end explicitly:
f = open(filename, "a+")
f.seek(0, os.SEEK_END)
Or use the io module which doesn't use the stdio of the C library and has a portable and reliable behaviour:
f = io.open(filename, "a+")
Georg Brandl: "This is a somewhat unfortunate difference between the major C libs and Python's new IO, but probably too late to change."
Since it's easy to workaround the issue and only one user complained lat 2 years (3 years?), sorry, I close now the issue.
I add this bug to my long list of bugs in the C stdio which won't be fixed in Python 2...
http://haypo-notes.readthedocs.io/python.html#bugs-in-the-c-stdio-used-by-the-python-i-o
----------
resolution: -> wont fix
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22651>
_______________________________________
More information about the Python-bugs-list
mailing list