[Tutor] "standard output: Broken pipe"

Alan Gauld alan.gauld at btinternet.com
Sat Oct 20 10:19:02 CEST 2007


"James" <jtp at nc.rr.com> wrote in message

> I have a snippet of code in a Python script I'm whipping up that's
> causing a not-so-pretty output.  Here's the code:
>
> subprocess.call( "yes '' | make oldconfig" , shell=True )
> -----
> yes: standard output: Broken pipe
> yes: write error
> -----
> off).  However, I'd like to figure out a way to get rid of the error
> (or hide it) so that it's not visible to the person running the

Can you capture stdout (actually its probably stderr) and
save it to a logfile? Or even just discard it?
I know the Popen class can do that but I can't recall if
call() has a stdout= option. If not just convert the code
to use Popen...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list