tee-like behavior in Python
Chris Rebert
clp2 at rebertia.com
Wed May 9 17:51:35 EDT 2012
More information about the Python-list mailing list
Wed May 9 17:51:35 EDT 2012
- Previous message (by thread): tee-like behavior in Python
- Next message (by thread): Real time event accuracy
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, May 9, 2012 at 8:35 AM, Florian Lindner <mailinglists at 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
- Previous message (by thread): tee-like behavior in Python
- Next message (by thread): Real time event accuracy
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list