On Wed, May 25, 2011 at 2:00 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > You're opening the file in text mode, and seeking relative to the end > of the file is not allowed in text mode, presumably because the file > contents have to be decoded, and, in general, seeking to an arbitrary > position within a sequence of encoded bytes can have undefined results > when you attempt to decode to Unicode starting from that position. > > The strange thing is that you _are_ allowed to seek relative to the > start of the file.
I think that with text files seek() is only really meant to be called with values returned from tell(), which may include the decoder state in its return value. -- http://mail.python.org/mailman/listinfo/python-list