[issue3207] file.write() after file.readline() in mode "r+"

Amaury Forgeot d'Arc report at bugs.python.org
Thu Jun 26 13:48:38 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

I tried this on windows 2000:

>>> # create a file with some text
>>> open("delete.me","w").write("some text\n")
>>>
>>> fp = open("delete.me", "r+t")
>>> fp.readline()
'some text\n'
>>> fp.write("New line \n")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 0] Error

On all 2.x versions of python I tried (2.4, 2.5.1, 2.5.2, 2.6b1, some
compiled with VS7.1, some with VS8.0)

With python3.0, there is no error, and the "New line" is appended at the
end of the file.

issue1636874 may be related to this one.

----------
nosy: +amaury.forgeotdarc

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


More information about the Python-bugs-list mailing list