import subprocess def runGetOutput(cmdAndArgs): pipe = subprocess.Popen(cmdAndArgs, stdout=subprocess.PIPE, shell=True); text = pipe.communicate()[0] #print cmdAndArgs return text # pipe is destroyed upon scope exit??