.py and running in Windows:

Iain King iainking at gmail.com
Tue Jun 13 09:48:23 EDT 2006


Andrew Gwozdziewycz wrote:
> You'll have better results posting this to it's own thread.
>

He certainly should have, but since I've read it here anyway:


> On Jun 13, 2006, at 9:29 AM, Michael Yanowitz wrote:
>
> > Hello:
> >
> >   Presently in my Windows 2000 system, when I double-click on a
> > .py file (open it) it automatically runs it in Python. I would
> > like to change that behavour. That is fine for .pyc file, but
> > for .py files, I would either like to have it run in Python but
> > return to the Python shell prompt when finished rather than
> > exit the shell. How do I do that?
> >   Or would it cause a problem (so that Python no longer works) if
> > I change the default .py extension to open in an editor rather
> > than execute it if I open it?
> >

In an explorer window, go to Tools->Folder Options
Go to the File Types tab, find the PY extension, then click on
Advanced*
Select the 'open' action, and click Edit...
change the 'Application used to perform action', inserting a '-i'
between the exe and the first parameter.  For example, I changed mine
to:

"C:\Python\python.exe" -i "%1" %*

The exact line will depend on where your python.exe is.
OK all the dialogs you've opened, then double click a .py file to test
it.

*I'm using WinXP, so the exact name of some of the buttons may be
different for you.

Iain




More information about the Python-list mailing list