[Tutor] Strange XP stdin behaviour.

Alan Gauld ukc802591034 at btconnect.com
Sat Aug 27 08:55:37 CEST 2005


>> C:\somepath> intest.py < in.txt
>>
>> There is no output!
>> In fact, I get an error:
>
> Yes, this is a Windows-specific thing.  Unfortunately, Windows's 
> treatment
> of shell scripts is slightly inconsistant.  However, there are 
> workarounds
> by making a '.CMD' file.  See:
>
>    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/366355
>

Thanks Danny, interesting link in that it shows a solution I
didn't know about in the one-liner at the bottom of the discussion.

But really I was hoping someone could explain *why* there is a 
difference.
If PATHEXT can detect that intest.py needs to be run through Python 
why
doesn't redirection work as expected? What is happening to 
stdin/stdout
in this case?

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld 



More information about the Tutor mailing list