[Tutor] [Q] How to run a Python file from Windows 2000 folder
Mon, 20 Aug 2001 14:07:16 -0400
On Mon, Aug 20, 2001 at 11:49:29AM -0700, Young-Jin Lee wrote:
| Hi, all.
| I have a problem running a python file from windows 2000 folder.
| I expected my python file to be executed when I double-clicked it,
| but I got "Program Not Found" error dialog box which required me to
| find where "Program.exe" is located. I guess it might be a window
| registry problem....
| I manually assigned Python.exe to *py file in a property menu of the
| my python source file, but it didn't work.
| What should I do to execute a python source file by double-clicking it?
If you installed python from python.org then it should have set the
file associations properly. In any case you can set it by hand using
the following steps :
open explorer (the disk kind, not the internet kind)
click Tools->Folder Options
select the "File Types" tab in the dialog that appears
scroll down until you find the .py extension
(if it doesn't exist yet, click the "New" button below the
scroll pane, enter the extension and click "Ok")
click the "Advanced" button near the bottom
create/edit the "Open" operation -- the command is
set the default operation to be "Open"
click "Ok" numerous times (to close the numerous dialogs)
test it by double clicking on a .py file
do the same thing for .pyw files, but specify "pythonw.exe"
instead of python.exe for the command.
I don't know why MS thinks that is easier than "#!/usr/bin/env python" at the
top of the file and "chmod u+x <filename>"!