Environmental Variables

Sathyaish sathyaish at gmail.com
Mon Mar 13 12:01:47 CET 2006


Thanks for the replies.

I am trying to have a startup file execute everytime I launch the
interpreter. So, for a test, I wrote a small file I called
"Sathyaish.py". The contents of the file were simply:

# ! This is my new start-up file.

print "Sathyaish is the best."


Then, in the interpreter, on its prompt, I said:

>>> os.environ['PYTHONSTARTUP'] = 'C:\\Sathyaish.py'
>>>

It didn't complain. I tested it immediately. On the same interpreter
instance, I said:

>>> import os
>>> os.environ.get('PYTHONSTARTUP')

It gave me back 'C:\Sathyaish.py'. I didn't close that interpreter. I
left it open and launched a new instance of the interpreter. In this I
queried the same:


>>> import os
>>> os.environ.get('PYTHONSTARTUP')
None

was what I got. I checked the at DOS prompt (cmd) for PYTHONSTARTUP,
and I got an 'unrecognized program/command/batch file' interrupt.

What's the deal with environmental variables? Are they specific to an
interpreter session? That shouldn't be.




More information about the Python-list mailing list