Trying to chain processes together on a pipeline

Chris Rebert clp2 at rebertia.com
Tue Jun 28 02:52:28 EDT 2011


On Mon, Jun 27, 2011 at 11:47 PM, Andrew Berg <bahamutzero8825 at gmail.com> wrote:
> On 2011.06.28 01:32 AM, Peter Otten wrote:
>> >>> subprocess.call(["ls"], stdout=open(os.devnull, "w"))
>> 0
> D'oh! Not sure why I was thinking os.devnull was a file object. :-[

On the bright side, I think in part due to this /exact/
misunderstanding, in bleeding-edge Python v3.3 you can now write:
>>> subprocess.call(["ls"], stdout=subprocess.DEVNULL)

http://docs.python.org/dev/library/subprocess.html#subprocess.DEVNULL

Cheers,
Chris



More information about the Python-list mailing list