stdin, stdout, redmon

Thynnus thynnus at gNOTmail.com
Tue Jan 22 17:33:48 CET 2008


On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote:
> Hi,
> 
> This is Windows bug that is described here: http://support.microsoft.com/default.aspx?kbid=321788
> 
> This article also contains solution: you need to add registry value:
> 
> HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies
> \Explorer
> InheritConsoleHandles = 1 (REG_DWORD type)
> 
> Do not forget to launch new console (cmd.exe) after editing registry.
> 
> Alternatively you can use following command
> 
>   cat file | python script.py
> 
> instead of
> 
>   cat file | python script.py
> 
> Regards,
> Konstantin

Nice one, Konstantin!

I can confirm that adding the registry key solves the problem on XPsp2:

-----After adding InheritConsoleHandles DWORD 1 key-----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\temp>type test3.py | test3.py
['import sys\n', '\n', 'print sys.stdin.readlines ()\n']

D:\temp>

The KB article is quite poorly written. Even though it seems to state that 
issue was 'solved for win2k with sp4, for XP with sp1', and gives no indication 
that the key is needed after the sp's are applied *even though* it is in fact 
necessary to the solution.

Questions:
     -Any side effects to look out for?
     -If the change is relatively benign, should it be part of the install?
     -Is this worth a documentation patch? If yes to where, and I'll give it a 
shot.

-Thynnus



More information about the Python-list mailing list