#NEWLINE# def read_process( cmd , args = '' ) : #NEWLINE# #INDENT# ( pipein , pipeout ) = os . popen4 ( ( '%s %s' % ( cmd , args ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# firstline = pipeout . readline ( ) #NEWLINE# if re . search ( '(not recognized|No such file|not found)' , firstline , re . IGNORECASE ) : #NEWLINE# #INDENT# raise IOError ( ( '%s must be on your system path.' % cmd ) ) #NEWLINE# #UNINDENT# output = ( firstline + pipeout . read ( ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# pipeout . close ( ) #NEWLINE# #UNINDENT# return output