select.select for non-sockets in win2k

Alex Eggenberger eggy at island.net
Sat Jul 13 18:36:11 EDT 2002


Is there still no select.select function that works with non-sockets
like the object returned by os.popen()?

If not, is there a way of displaying the stdout/stderr data as it
becomes available from os.popen3() calls?  To clarify, I want to do
something like

stdin, stdouterr = os.popen4("SomeCommand")
KeepPolling = 1
while KeepPolling:
   ThisPoll = select.select([stdouterr],[],[],1)
   str = stdouterr.readline()
   if re.search(EOF,str):
      KeepPolling = 0
   else:
      print str

The intent is to print new data as it appears in the stdouterr pipe. 
Last time I attempted to do this sort of thing I was stumped because
select.select() would simply could not accept the stdouterr pipe.

Is this still the case?  Is there another way of approaching this
problem?



More information about the Python-list mailing list