[Tutor] Windows questions

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Sep 3 00:23:38 EDT 2003


> 1. How do you set the PATH environment variable for python under
windows 98

Look it up in the Windows Help file for full info. But basically you
add a line in your C:\AUTOEXEC.BAT file that looks like:

PATH=%PATH%;C:\PYTHON

or wherever you installed Python....

> (So that I can import modules which aren't located in the same
folder as
> python itself)

 However to access modules you really need the PYTHONPATH calue set
which is similarly in AUTOEXEC.BAT but looks like:

SET PYTHONPATH=C:\PROJECTS\PYTHON

or wherever you keep you modules

> If I just double click on a python script. It automatically executes
under
> the DOS interpreter, and then closes itself too quickly to see what
the
> results were. Is it possible to change this?

There are several ways. They all have their own advantages:

1) Add a line like

raw_input("Hit Enter to quit")

at the end of your program.

2) Modify the action associated with opening a Python file using
Windows
explorer so that the interpreter is called with the -i flag set. This
will make
your program run then stop in the interpreter at the >>> prompt.

3) Create a shortcut to the file and then set it to leave the window
open
on completion - only sensible if you ruin the same program a lot.

Personally I tend to use the first option.

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



(That is, make it so that the
> program doesn't automatically close the DOS Prompt after its
finished
> executing, or get it to automatically execute under the Windows
IDLE)
>
> *****A Network is the Opposite of a Hierachy*****
>
>
>




More information about the Tutor mailing list