Uwe Mayer wrote: > <posted & mailed> > > Hi, > > AFAICT there seems to be a bug on FreeBSD's Python 2.3.4 open function. The > documentation states: > > >>Modes 'r+', 'w+' and 'a+' open the file for updating (note that 'w+' >>truncates the file). Append 'b' to the mode to open the file in binary >>mode, on systems that differentiate between binary and text files (else it >>is ignored). If the file cannot be opened, IOError is raised. > > > Consider: > > $ cat test > lalala > > $ python2.3 > Python 2.3.4 (#2, Jan 4 2005, 04:42:43) > [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 > Type "help", "copyright", "credits" or "license" for more information. > >>>>f = open('test', 'r+') >>>>f.read() > > 'lalala\n' > >>>>f.write('testing') >>>>f.close() >>>> > > [1]+ Stopped python2.3 > $ cat test > lalala > > -> write did not work; ok >
This worked here on freebsd 5.4 / python 2.4 > $ fg > python2.3 > >>>>f = open('test', 'a+') >>>>f.read() > > '' > > -> append mode does not read from file, *not ok* > > This is right IMO 'a' is appending so seek(-1) Ciao -- http://mail.python.org/mailman/listinfo/python-list