[Tutor] PYTHONSTARTUP under Win98

Patrick K. O'Brien pobrien@orbtech.com
Fri, 8 Jun 2001 12:41:24 -0500


I have a python script (.pythonrc.py) created and pointed to by
PYTHONSTARTUP in my autoexec.bat file under Win98SE. If I go to a dos prompt
and start python, the startup script is executed properly because the
functions I defined in .pythonrc.py are available according to dir() and
simply by using them. So everything is setup properly.

However, nothing happens when I launch one of the IDEs, such as IDLE,
PythonWin or Boa. I would have expected the interactive windows of these
tools to have executed my startup script. I know they can "see" it because
the following works:

>>> dir()
['__builtins__', '__doc__', '__name__', 'pywin']
>>> import os
>>> os.environ.get('PYTHONSTARTUP')
'C:\\My Documents\\pobrien\\.pythonrc.py'
>>> execfile(os.environ.get('PYTHONSTARTUP'))
>>> dir()
['__builtins__', '__doc__', '__name__', 'doc', 'help', 'os', 'pywin']
>>>

So what gives? Is this the expected behavior? I just found an IDLE command
line flag (-s will run $IDLESTARTUP or $PYTHONSTARTUP first) in the help
file. So maybe that is the case.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."