Determining EOF character

Daniel Klein danielk at aracnet.com
Sun Feb 18 13:34:42 EST 2001


When managing child processes (like with popen2.popen2) I have occasion to do

	instream.readlines()

to get all lines in a list rather than

	instream.readline()

which gets the next line terminated with 'os.linesep'.

On Windows the child process needs to send a ^Z in response to readlines() and
on UNIX it needs to send ^D. I don't know what this is on MAC.

What I would like to do is to tell the child process what to use as the EOF
character so that my code is platform independent. I have searched thru the
'os' and 'sys' modules for something like a 'os.eof' or 'sys.eof' with no joy.

I am currently using '#ifdef WIN32' to determine this in the child process but
I would like to move this up to the controlling Python program.

If this exists please let me know where. If not, how do I submit an enhancement
request?

Thank you,
Daniel Klein



More information about the Python-list mailing list