os.popen and broken pipes
Philipp Pagel
pDOTpagel at gsf.de
Fri Feb 9 07:33:59 EST 2007
Antoon Pardon <apardon at forel.vub.ac.be> wrote:
> On 2007-02-09, Philipp Pagel <pDOTpagel at gsf.de> wrote:
> > for filename in file_list:
> > file = os.popen('uncompress -c '+filename, 'r')
> > do_something(file)
> > file.close()
> >
> > This works fine for some files but results in
> >
> > 'write error onstdout: Broken pipe'
> As far as I can tell, your do_something doesn't consume the entire file.
> So you close the file prematurly, which results in the uncompress/zcat
> program trying to write to a pipe that is closed on the otherside,
> giving you the above message.
You are right: some of the files do not fulfill certain
critereia causing so_somehting() to return before the entire file is
processed.
Thanks!
cu
Philipp
--
Dr. Philipp Pagel Tel. +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186
Technical University of Munich
http://mips.gsf.de/staff/pagel
More information about the Python-list
mailing list