Running Python scripts under W2K with I/O redirection

vincent wehren vincent at visualtrans.de
Sat Jun 25 02:26:36 EDT 2005


<sub1ime_uk at yahoo.com> schrieb im Newsbeitrag 
news:1119629947.977882.174830 at g49g2000cwa.googlegroups.com...
|I apologise if this is a well known problem. I've searched and can't
| find a clear description or fix. Hope someone can help.
|
| I am running my Python scripts under Windows 2000 using Python 2.4
| Build 243 from Activestate.
|
| If I want to specify a file as standard input to my script I can just
| enter a command like:
|
|  H:\> pyscript.py file.inp
|
| and that's what I get. All ok so far.
|
| However if I enter commands like:
|
|  H:\> type file.inp | pyscript.py
|
| or
|
|  H:\> pyscript.py < file.inp
|
| It doesn't work. I've also tried the variant of parsing for a command
| line argument of '-' or 'filename' and then specifically either copying
| the sys.stdin file object or opening the file specified, then using
| that file object. Same problem.
|
| Interestingly enough, if I specify my commands as:
|
|  H:\> type file.inp | python pyscript.py
|
| or
|
|  H:\> python pyscript.py < file.inp
|
| It all works the (unix-like) way I wanted it to. This leads me to
| suspect there is something wrong in the way that Python is being
| invoked by Windows in my problem situation rather than an inherent
| fault within Python itself.

Your suspicion is correct

see:

http://support.microsoft.com/default.aspx?kbid=321788

--

Vincent Wehren



|
| Does anyone have any idea what the problem could be and how to fix it?
| I know its a really minor niggle but it'd make this poor deprived
| unix-guy-forced-into-windows-servitude very happy.
|
| Thanks,  sub1ime_uk
|
| sub1ime_uk (at) yahoo (dot) com
| 





More information about the Python-list mailing list