def check_executable(exe, args=[]):
 try:
  subprocess.Popen(([exe] + args), stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
 except OSError:
  return False
 return exe

def check_executable ( exe , args = [ ] ) : try : subprocess . Popen ( ( [ exe ] + args ) , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) . communicate ( ) except OSError : return False return exe
checks if an executable exists in $path .