> When you write to file, > 1. writer is checked for null. If it is, stream is not writable. Raise > exception. > 2. string is passed to the writer. > 3. The writer does appropriate newline translation and write it. > 4. The number of bytes written, after newline translation, is returned. > 5. reader is checked for null. If it is, some steps are skipped. > 6. reader's position is read. > 7. The number of bytes written is added to the current position. > 8. reader's position is set to the sum in 7 in order to syncrhonise. > > 6 will cause seek error if stream is not seekable. This doesn't > happen, because reader implementations maintain position by themselves > instead of reading underlying stream's position. It does read > underlying stream's position in the constructor, but only if it's > seekable. Bah, except PythonBinaryReader, that is. > > So seek error is inevitable, whenever all of following conditions are met: > 1. write() is called > 2. underlying stream is writable > 3. underlying stream is readable > 4. binary reader is used > 5. underlying stream is not seekable >
Great analysis Seo. What I don't understand is why this happens only in binary mode, and when the write flag is set. Why is there a PythonBinaryReader created at all? I'm setting up my development environment to trace the IP code. http://baus.net/ _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
