On 06/28/2010 12:05 PM, Dave Pawson wrote: > On 28 June 2010 18:39, Michael Torrie <torr...@gmail.com> wrote: > >> Sure. I've created a module called runcmd that does 90% of what I >> want (easy access to stdout, stderr, error code). I've attached >> it to this e-mail. Feel free to use it; this post puts my code >> into the public domain. > > Request please Michael. > > Examples of usage in the docstring?
Well the simplest form is as I showed in my e-mail: (err,stdout,stderr) = runcmd.run (['command','arg1','arg2', ... ]) An example where you need to pass stdin: input="some string\n" (err,stdout,stderr) = runcmd.run (['cmd','arg1',], stdin=input) err is the return error code (int) and stdout and stderr are the strings the result from the process's output, both strings. There are some other features (or bugs probably) that you can get from the source code itself. I think at one time I wanted to be able to have callbacks that would do something with stdout and stderr (in a real-time, unbuffered way), but I have never used them and don't think they work. -- http://mail.python.org/mailman/listinfo/python-list