[Tutor] help with getting python to run from command prompt onWindows XP

Alan Gauld alan.gauld at btinternet.com
Thu Jan 15 01:34:14 CET 2009

"Brian van den Broek" <vanden at gmail.com> wrote

> icon for Idle launching as expected. When run from IDLE, `print 
> sys.executable' yields `C:\\Python26\\pythonw.exe'.
> He reports that C:\Python26 contains both python.exe and 
> pythonw.exe.
> I've had him add the text `;C:\Python26' (without quotes) to the end 
> of his Path environment variable via the Control Panel|System 
> Properties way of editing Environment variables. I've had him reboot 
> afterwards.

Get him to type

SET > env.txt

at the DOS prompt that should list all environment variables into 

Get him to email that file to you and check what it says about PATH.

> After all of that, he reports that an attempt to run python from the 
> command prompt produces a complaint that `` `python' is not 
> recognized as an internal or external command, operable program or 
> batch file.''

What happens if he types

C:PROMPT> C:\Python26\python.exe

In other words uses the full path?

> Can someone with Windows knowledge please tell me what I am missing?

Nothing so far as I can tell, but from experience you need to double 
the settings at every stage, its very easy to make a mistake - like 
a colon instead of semi colon etc.

> pythonw.exe is what you associate with .py files to prevent a 
> double-click on a .py icon from producing the `DOS box flash' and 
> *not* what one wants to use from the prompt itself.)

pythonw is used for running GUI apps without a console appearing in
the background. You definitely don;t want to runpythonw from the
command line!

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list