def call(cmd): args = shlex.split(str(cmd)) p = Popen(args, stdout=PIPE, stderr=PIPE) text = p.stdout.read() if not text: text = p.stderr.read() return text