Stdin is missing for any i pipe process that uses the ftype mechanism and its associated mechanism to select the correct executable

I am in WindowsXP. This seems to affect any process, but I will use Python3.2 to demonstrate it. A script, 'filter.py':

import sys
for line in sys.stdin:
    print(line)

The launch is as follows:

echo hello | filter.py

Torn as follows:

Traceback (most recent call last):
  File "F:\Documents and Settings\jhartley\docs\projects\filtercwd\filter.py", line 3, in <module>
    for line in sys.stdin:
TypeError: 'NoneType' object is not iterable

Of course, adding a seal to find out the value of sys.stdin, reports that it is None (and NoneType.)

Alternatively, follow these steps:

echo hello | python filter.py

(with an explicit python call) works fine.

My .py files are connected for execution using Python using the assoc and ftype mechanism (the way Windows associates specific file name extensions that will be executed using certain programs):

> assoc .py
.py=Python.File
> ftype Python.File
Python.File="F:\Python32\python.exe" "%1" %*

( "python.exe", )

. Python. , filter.sh, cygwin bash. 'echo hello | bash filter.sh ' , ' echo hello | filter.sh ', filter.sh bash assoc ftype, '/dev/stdin: .

, "python" ? , , . - , ?

+5
1

echo ? echo UNIX Microsoft ( , )? , echo on ?

Windows 7 . echo UNIX . 1.9.2 test.rb:

while s = $stdin.gets
  print s
end

:

  • test.rb
  • ruby test.rb
  • echo hello | test.rb
  • echo hello | ruby test.rb

1 2 . 3 4 . , .

1: , :

C:\Users\David\Documents\scraps\test_ruby>ls
test.rb

C:\Users\David\Documents\scraps\test_ruby>assoc .rb
File association not found for extension .rb

C:\Users\David\Documents\scraps\test_ruby>echo hi | test.rb
hi

ftype, , , ruby ​​ , .

+1

All Articles