Mailbox, tell and read
paul at prescod.net
Wed Jun 30 19:53:38 EDT 1999
The mailbox message objects simulate a file interface by seeking through a
mailbox. A read() returns the entire message. It does this by seeking to
the start, reading to the message end, and returning the data. The problem
is that message offsets are derived by file.tell() which I presume is in
terms of bytes. But then it does a read() based on the offsets and read()
is in terms of characters.
These don't match up on Windows because of CR/LF pairs. I think that the
right fix is to never use tell() and instead keep track of the location by
counting characters. Does that make sense?
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
"I don't want you to describe to me -- not ever -- what you were doing
to that poor boy to make him sound like that; but if you ever do it
again, please cover his mouth with your hand," Grandmother said.
-- John Irving, "A Prayer for Owen Meany"
More information about the Python-list