Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Writing binary to stdout
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Paul Watson, post: 1765312"] This will be a command to run a python script from inside another tool. It -must- write to stdout. Also, Cygwin is on the machine. Even when I try to use low-level I/O it does CRLF interpretation. What am I doing wrong? pwatson [ watsonp:/cygdrive/c/src/projects/pwatson/bin ] 22 $ cat ./wb.py #! /usr/bin/env python import sys import os try: import msvcrt f = os.open(1, 'wb') except: f = sys.stdout f.write("now\n") f.close() sys.exit(0) pwatson [ watsonp:/cygdrive/c/src/projects/pwatson/bin ] 23 $ ./wb.py >jjj pwatson [ watsonp:/cygdrive/c/src/projects/pwatson/bin ] 24 $ od -c jjj 000000 6e 6f 77 0d 0a n o w \r \n 000005 [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Writing binary to stdout
Top