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

2008-06-26 Thread Peter
New submission from Peter [EMAIL PROTECTED]: Following code: fp = open(delete.me, r+t) fp.readline() fp.write(New line \n) fp.close() Won't do anything. I mean nor writing to file, nor raising exception. Nothing. I can't find any note about this crap. So, it is the best place for

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

2008-06-26 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] 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,

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

2008-06-26 Thread Peter
Changes by Peter [EMAIL PROTECTED]: ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3207 ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2008-06-26 Thread Peter
Peter [EMAIL PROTECTED] added the comment: Amaury Forgeot d'Arc, your example really raise IOError 0 Thing is that you had 1 string in the file Here is it: open(delete.me, w).write(first\nsecond\nthird) fp = open(delete.me, r+t) fp.readline() 'first\n' fp.write(Newbie) fp.close()

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

2008-06-26 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: Yes, the exact behaviour depends on multiple aspects. You should follow the C library conventions: http://www.cplusplus.com/reference/clibrary/cstdio/fopen.html For the modes where both read and writing (or appending) are allowed