473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Question about stdin and PATHEXT on Windows XP

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.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Oct 2 '05 #1
1 1425
Lasse Vågsæther Karlsen wrote:
I got a loop like this:

<snip>

Ok, I've found some information. I don't like the answer but it doesn't
seem to be any good way to do this without hacking it one way or the other.

If someone has a brilliant answer that isn't in google yet, please let
me know.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Oct 2 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: The Jetman | last post by:
I'm trying to port PyWin into a limited version of Windows XP, called BartPE. Essentially, it's a matter of taking the installed elements of most WinApps (ie. registry settings and files) and...
9
by: It's me | last post by:
Why do I get an "AttributeError: read" message when I do: import sys r=sys.stdin.read() ?? I've tried: r=sys.stdin.read(80)
3
by: Brent W. Hughes | last post by:
I'd like to get a character from stdin, perform some action, get another character, etc. If I just use stdin.read(1), it waits until I finish typing a whole line before I can get the first...
11
by: Tom Willis | last post by:
I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. rem = """-*-Python-*- script @echo off rem...
0
by: Joe Burnett | last post by:
Hello, I am using the following perl read function to read form information from a client web page: read(STDIN, $GN_QUERY, 100); Everything works fine on a Linux/Apache server. I get the...
3
by: Mike Tammerman | last post by:
Hi, I want create a subprocess using Popen and pipe some input to it. Although everything works perfectly while executing python in, it doesn't work if I try with executables made by py2exe. ...
6
by: Charlie Zender | last post by:
Hi, I have a program which takes the output filename argument from stdin. Once the program knows the output filename, it tries to open it. If the output file exists, the program asks the user to...
7
by: hg | last post by:
Hi, Is there a way ? ... select ? hg
27
by: R2D2 | last post by:
Hi, could someone please explain to me, why in the following code the second approach does not work? Thanks for your help. #include <vector>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.