?
=?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?=
I got a loop like this:
while True:
line = sys.stdin.readline()
if not line:
break
line = line.rstrip()
log_message(options.channel_name, line)
print line
this loop will read text if I execute it from a command prompt like this:
dir | python.exe log.py
however, since I've set PATHEXT to contain .PY, I tried this:
dir | log.py
which ended up with the loop just skipping.
Does anyone know how to fix this problem ? Being able to use PATHEXT
execution (just execute python file directly) and still being able to
grab stdin? I assume that since there is some magic involved in invoking
python.exe here, stdin gets munged on the way.
while True:
line = sys.stdin.readline()
if not line:
break
line = line.rstrip()
log_message(options.channel_name, line)
print line
this loop will read text if I execute it from a command prompt like this:
dir | python.exe log.py
however, since I've set PATHEXT to contain .PY, I tried this:
dir | log.py
which ended up with the loop just skipping.
Does anyone know how to fix this problem ? Being able to use PATHEXT
execution (just execute python file directly) and still being able to
grab stdin? I assume that since there is some magic involved in invoking
python.exe here, stdin gets munged on the way.