PYTHONSTARTUP doesn't seem to work

I am trying to use the PYTHONSTARTUP environment variable. I installed it as "c: \ python25 \ pythonstartup.py" in "My Computer" β†’ "Advanced", etc., and it does not work.

Opening IDLE does not run the script, although it recognizes the variable:

>>> import os >>> os.environ['PYTHONSTARTUP'] 'c:\\python25\\pythonstartup.py' >>> 

I am using XP and Python 2.5.2. I do not want to upgrade to 3.0.

thanks

+6
python startup
source share
2 answers

The documentation says that PYTHONSTARTUP is only launched for interactive sessions. I'm not sure how IDLE launches the Python interpreter, but this may interfere.

Instead, try running python directly from the command line, rather than clicking on the icon.

+5
source share

To add the correct answer to Greg Hewgill: if IDLE does not have its own startup file, you can put a file called sitecustomize.py in your path, which will be run for both the command line and IDLE scripts / sessions.

+2
source share

All Articles