How to designate sys.stdout for binary output in win32?

John Machin sjmachin at lexicon.net
Sun May 4 15:52:02 EDT 2003


On Sun, 04 May 2003 10:50:16 GMT, "C.M. Lim" <cmlim at ieee.org> wrote:

>I need to print strings as-is, control/escape chars et al, to sys.stdout in
>a win32 python environment (in Unix, this would be trivial).
>
>I found some sample code that uses msvcrt module to explicitly set the 
>BINARY mode, as follows:
[snip]
>but on my system (Python2.1.1), sys.stdout is a PyShell.PseudoFile 
>instance, and does not have a fileno() method.
>

Please let us know what piece of software you expect to act on the
escape sequences and control characters that you wish to send to
sys.stdout.

If it is Pyshell, then you should be addressing your question to the
PyShell maintainer(s).

If it is not PyShell, but some other gadget, like a
green-screen-terminal emulator -- similar to the good ol' ANSI.SYS
console device driver on MS-DOS -- then it seems an incredibly good
bet that you may have to run Python at the command line.







More information about the Python-list mailing list