os.popen and broken pipes

Philipp Pagel pDOTpagel at gsf.de
Fri Feb 9 06:07:12 EST 2007


	Hi Pythoneers,

I need to process a large number of files which have been packed by the
UNIX compress tool (*.Z files). As I am not aware of a compress
equivalent of the gzip, zipfile or bzip2 modules, I thought I'd use the
uncompress or zcat commands directly to deal with the files:

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'

emitted by uncompress for others. Using zcat instead of uncompress
changes the wording of the error message but not the result.

I tried to give popen a large bufsize argument but that didn't really
help.

Probably I'm overlooking something obvious here but right now I can't
see it. Any hints?

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