os.popen(cmd,mode) question?

Blue whale arunramu at usa.net
Mon Jul 2 00:59:27 EDT 2001


Can anyone help me understand why I am not able to close() 
the pipe shown below. 

p = os.popen('vmstat 5')
p.readline() # works
p.readline() # works
p.close()    # does not work

Is there a way I can get this to work. The command 'vmstat 5'
produces output every 5 seconds, is there a way I can stop the command
by just closing the pipe. can I force a pipe to be closed(will that kill
the vmstat)???

Arun



More information about the Python-list mailing list