> >>> f = os.popen('ping 192.168.8.85 -c 100 > cap2.txt') > > You will see that I send the output from the command to a file, because > I want to test how stop the command before it reaches 100 pings. > If I don't write the output to the file 'cap2.txt' and succeeds in > closing 'f', all the data returned to 'f' will be lost.
You can read the output of popen into your program with f.read(), but that will read all of the output after the program has run. However I think you can readline() too to catch it line by line. You can also write() data to f thus allowing you to send your Ctrl-C.(You may need popen2 or even popen3 to do the simultaneous read//write bit. #Or better still use the new subprocess module in v2.4) Does that do what you need? Alan G _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor