In article <[EMAIL PROTECTED]>, Philipp Pagel <[EMAIL PROTECTED]> wrote:
> Antoon Pardon <[EMAIL PROTECTED]> wrote: > > On 2007-02-09, Philipp Pagel <[EMAIL PROTECTED]> 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. Most programming environments don't have this problem, though. If you like, your program can undo what Python does: signal.signal(signal.SIGPIPE, signal.SIG_DFL) for filename in file_list: ... Then it will work as if you had written it in C, or awk or whatever. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list