On 25/05/2011 21:54, Ian Kelly wrote:
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.

What do you mean by "may include the decoder state in its return value"?

It does make sense that the values returned from tell() won't be in the
middle of an encoded sequence of bytes.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to