Hi!
Thank you for info
--
Michel Claveau
----- Original Message -----
From: "Tim Roberts" <t...@probo.com>
To: "Python-Win32 List" <python-win32@python.org>
Sent: Monday, September 23, 2013 7:31 PM
Subject: [python-win32] Windows 7 Python Command Line Use
I'm posting here as a help for others, because if *I* got tripped up by
this, then it's certain others are going to fall into the same trap.
I've been doing Python for 16 years and Windows for 24. I should know
these things.
I recently had to replace my main development machine. Part of that
involved moving from the venerable but reliable Windows XP to Windows 7
64. I installed the 32-bit Python 2.7.5, because I do still use some
packages that don't support Python 3.
On the new machine, any attempt to run a Python script from the command
line using the .py file associations, and using stdout redirection,
failed:
C:\tmp>cat happy.py
print "Happiness!"
C:\tmp>python happy.py
Happiness!
C:\tmp>python happy.py > ok
C:\tmp>happy.py
Happiness!
C:\tmp>happy.py > notok
* close failed in file object destructor:**
** sys.excepthook is missing**
** lost sys.stderr*
C:\tmp>
I am pretty good with Google, and I found a lot of references to this
problem, but none of the suggestions made any sense. Some people said
the flaw was installing as administrator, and suggested creating a
separate administrator account to install as. That's silly.
In the end, the answer came from a Microsoft Knowledge Base article from
Windows 2000, of all things. It says the problem is fixed in later
versions, but apparently it is not. The article includes a quick
registry hack (InheritConsoleHandles), and this DOES fix the problem.
You have to restart Explorer after making the change (which you can do
from Task Manager, or by rebooting):
http://support.microsoft.com/kb/321788
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32