[Baypiggies] how can I change the input parameter in my executable while calling from either os.system or os.popen calls?

David Elsen elsen.david08 at gmail.com
Fri Aug 22 01:26:38 CEST 2008


thanks.

On Thu, Aug 21, 2008 at 1:39 PM, Matt Good <matt at matt-good.net> wrote:

> On Aug 21, 2008, at 10:01 AM, Joshua Gallagher wrote:
>
> There may be another, and better, way of doing it, but I usually use
>> Popen like this:
>> cmd = <something>
>> p_obj = subprocess.Popen(cmd, shell=True,
>>                        stdout=subprocess.PIPE,
>>                        stderr=subprocess.STDOUT)
>> output = p_obj.stdout.read()
>>
>
>
> Using the std* streams directly is prone to deadlock.  If you can, stick to
> using popen.communicate()
>
> proc = subprocess.Popen([cmd, arg1, arg2], stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> pout, perr = subprocess.communicate()
>
> http://docs.python.org/lib/node532.html
>
> -- Matt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20080821/6d3385b9/attachment.htm>


More information about the Baypiggies mailing list