piping out binaries properly

Mike Meyer mwm at mired.org
Wed Oct 12 08:08:07 CEST 2005

marduk <usenet at marduk.letterboxes.org> writes:

> On Wed, 2005-10-12 at 00:16 -0400, Mike Meyer wrote:
> [...]
>> It's not normal to write binary content to stdout - you normally write
>> it to a file. Open the file with open(name, 'wb') to write binaries.
> It is interesting that as a "Unix consultant" you should make that
> claim.  Especially since
>>>> sys.stdout
> <open file '<stdout>', mode 'w' at 0x2aaaaaac9198>
>       ^^^^
> Indeed there would be a lot of broken Unix systems out there if that
> were not the case.

Ain't ambiguity wonderful? That we use the same word to donote a
collection of bytes on a disk and a software entity that one can write
bytes to allows for all kind of mistaken interpretations.

Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list