[Python-bugs-list] [ python-Bugs-416906 ] readlines() corrupts file opened for 'a'

noreply@sourceforge.net noreply@sourceforge.net
Tue, 17 Apr 2001 18:10:23 -0700


Bugs item #416906, was updated on 2001-04-17 18:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416906&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: readlines() corrupts file opened for 'a'

Initial Comment:
Version 2.1 final release for Windows (using Idle)
Windows 98 2nd edition

f=open('c:\My Documents\textfile.txt', 'a')
f.write('hello file\n')
f.readlines()

raises the following error - it probably should.

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in ?
    f.readlines()
IOError: [Errno 9] Bad file descriptor

However, the file gets a bunch of garbage appended to 
it.  In some cases, the entire contents of the GUI 
window gets appended.   

In Redhat 6.2 (also with Version 2.1 Final)the same 
code just erases the file.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416906&group_id=5470