Interactive startup file
William Park
parkw at better.net
Sat Mar 17 19:49:29 EST 2001
On Sat, Mar 17, 2001 at 07:22:15PM -0500, Brendhan Horne wrote:
> In the tutorial it says in section 2.2.3
...
> import os
> filename = os.environ.get('PYTHONSTARTUP')
> if filename and os.path.isfile(filename):
> execfile(filename)
...
> Can some one please explain this to me in novice english and for a guy
> who is using windows98 with his python.
Well, it's exactly what it says.
If you set environment variable
PYTHONSTARTUP='.pythonrc'
then commands in file '.pythonrc' will be executed everytime you run
python in interactive mode (ie. when you get '>>>' prompt). For
example, mine contains
import rlcompleter
rlcompleter.readline.parse_and_bind('tab: complete')
If you want to run those commands from a script, then you have to call
the file explicitly, using
execfile('.pythonrc')
:wq --William Park, Open Geometry Consulting, Linux/Python, 8 CPUs.
More information about the Python-list
mailing list