On Fri, Mar 4, 2011 at 5:26 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: >> UnsupportedOperation: can't do non-zero end-relative seeks >> >> But offset is initialized to -10. Does anyone have any thoughts on >> what the error might be caused by? >> > I think it's because the file has been opened in text mode, so there's > the encoding to consider. It may be that it's to stop you from > accidentally seeking into the middle of a multibyte sequence, but > there's nothing to stop you doing that when seeking relative to the > start, for example, so it's possibly a pointless restriction.
I expect that's correct. The doc string from Python 2 included this nugget: If the file is opened in text mode, only offsets returned by tell() are legal. Use of other offsets causes undefined behavior. -- http://mail.python.org/mailman/listinfo/python-list