def exe_exists(exe):
 def is_exe(path):
  'Determine if path is an exe.'
  return (os.path.isfile(path) and os.access(path, os.X_OK))
 (path, _) = os.path.split(exe)
 if path:
  return is_exe(exe)
 else:
  for path in os.environ['PATH'].split(os.pathsep):
   if is_exe(os.path.join(path, exe)):
    return True
 return False

def exe_exists ( exe ) : def is_exe ( path ) : return ( os . path . isfile ( path ) and os . access ( path , os . X_OK ) ) ( path , _ ) = os . path . split ( exe ) if path : return is_exe ( exe ) else : for path in os . environ [ 'PATH' ] . split ( os . pathsep ) : if is_exe ( os . path . join ( path , exe ) ) : return True return False
determine whether path/name refers to an executable .