On Wed, May 9, 2012 at 8:35 AM, Florian Lindner <mailingli...@xgm.de> wrote: > Hello, > > how can I achieve a behavior like tee in Python? > > * execute an application > * leave the output to stdout and stderr untouched > * but capture both and save it to a file (resp. file-like object) > > I have this code > > proc = subprocess.Popen(shlex.split(cmd), stdout = subprocess.PIPE,
shlex.split() should just be used once, at "development time", to determine the form of the argument list. It shouldn't generally be used at runtime. Otherwise, you need to do the proper escaping/quoting yourself, which defeats the entire purpose of bypassing the shell. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list