Python is easy?

Bengt Richter bokr at
Thu Aug 15 07:26:24 CEST 2002

On Thu, 15 Aug 2002 04:31:20 GMT, "Patrick Ellis" <pellis at> wrote:

>"Christopher" <chris_mk at> wrote:
>> Having said that, here is what I recommend you do to run your script.
>> Open a console (I am assuming you have a Wintel system).  cd to the
>> directory containing your test1 module.  Then type in your full
>> python.exe path then your full module name (on my Wintel it is,
>> C:\Python22\python.exe
>In my experience, the Windows install for Python sets up the registry so
>that *.py files are recognized as Python scripts. Typing "" (note
>that the .py is important) will run the installed Python with the test1
>script. This is similar to running a .exe, except for the required
>extension. There is no need to know where python.exe is, or put it in your
>path, unless you explicitly want the interactive prompt.
>Double clicking a *.py file in explorer will also run the script, as above.
>Again, just like a .exe. The drawback is that the DOS shell that appears,
>will disappear as soon as the program exits, whether normally or due to an
>error. It would be nice if someone out there knew how keep the window up
>after exit, especially due to a compile error. I use sys.stdin.readline() at
>the end of many scripts to force a CR to end the script and close the
>window, but this doesn't help the error cases.

Find the shortcut and change the target line from



    %systemroot%\system32\cmd.exe /k D:\Python22\python.exe

if you're on NT.

or just

    cmd.exe /k D:\Python22\python.exe

should work too. IOW you are running cmd.exe to create a "DOS" window in which to run python.exe,
and when that exits, the "/k" will keep the DOS window. If you don't change the default working
directory ("Start in:" line in the short cut properties), you will have D:\Python22 or your equivalent.
It's handy to change it to your normal test snippet directory, since then you will be able
to import from there my default.

You might want to change the name of the shortcut too, and/or make the changes on a copy
if you want the old functionality as well for whatever reason.

Bengt Richter

More information about the Python-list mailing list