[Tutor] [Q] How to run a Python file from Windows 2000 folder
dman
dsh8290@rit.edu
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 :
1)
open explorer (the disk kind, not the internet kind)
2)
click Tools->Folder Options
3)
select the "File Types" tab in the dialog that appears
4)
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")
5)
click the "Advanced" button near the bottom
6)
create/edit the "Open" operation -- the command is
<path-to-python>\python.exe "%1"
7)
set the default operation to be "Open"
8)
click "Ok" numerous times (to close the numerous dialogs)
9)
test it by double clicking on a .py file
10)
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>"!
-D