Interactive startup file

Tim Peters tim.one at home.com
Sat Mar 17 19:46:37 EST 2001


[Brendhan Horne]
> ...
> Can some one please explain this [PYTHONSTARTUP] to me in novice
> english and for a guy who is using windows98 with his python.

Here's a screen dump from a Win98 DOS box:

C:\Python20>echo print "hi" > somefile.py

C:\Python20>type somefile.py
print "hi"

C:\Python20>set PYTHONSTARTUP=c:\python20\somefile.py

C:\Python20>python
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
hi
>>>

Note that somefile.py got executed (it printed "hi") when I started Python
from the cmdline.

Note that very little of this has to do with Python:  "echo" and "type" and
"set" are all Windows DOS-box commands.  If you want to make the value of the
environment variable PYTHONSTARTUP persist across sessions, you're going to
have to plumb the mysterious depths of autoexec.bat in Win98.  Or you could
decide that this isn't something you actually need <wink>.

more-than-one-way-to-get-out-of-a-corner-ly y'rs  - tim





More information about the Python-list mailing list