--- wave.py-old 2009-02-10 11:48:05.000000000 +0000 +++ wave.py 2009-02-10 11:48:35.000000000 +0000 @@ -462,14 +462,24 @@ if not self._nframes: self._nframes = initlength / (self._nchannels * self._sampwidth) self._datalength = self._nframes * self._nchannels * self._sampwidth - self._form_length_pos = self._file.tell() + try: + self._form_length_pos = self._file.tell() + except IOError: + # tell will fail when the output is a pipe. We don't care + # unless we end up patching the header. If we do patch the + # header then _form_length_pos being unset will cause it to + # fail then. + pass self._file.write(struct.pack('