#NEWLINE# def which( self , program ) : #NEWLINE# #INDENT# def is_exe( fpath ) : #NEWLINE# #INDENT# return ( os . path . isfile ( fpath ) and os . access ( fpath , os . X_OK ) ) #NEWLINE# #UNINDENT# ( fpath , fname ) = os . path . split ( program ) #NEWLINE# if fpath : #NEWLINE# #INDENT# if is_exe ( program ) : #NEWLINE# #INDENT# return program #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for path in os . environ [ 'PATH' ] . split ( os . pathsep ) : #NEWLINE# #INDENT# path = path . strip ( '"' ) #NEWLINE# exe_file = os . path . join ( path , program ) #NEWLINE# if is_exe ( exe_file ) : #NEWLINE# #INDENT# return exe_file #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return None