[Tutor] PYTHONSTARTUP under Win98

Patrick K. O'Brien pobrien@orbtech.com
Sat, 9 Jun 2001 09:52:01 -0500


Thanks. I'm slowly catching on. The more I learn Python, the more impressed
I am with the language ... and the more disappointed I am with the
information about the environment. I think the setup and configuration of
Python is still too big of a barrier for newbies. Python 2.1 and distutils
has helped a lot, but there are still too many gotchas that get in the way.
And if you want to be seriously productive you're going to want to control
the python environment. For me, that means getting everything working the
way I want it to in IDLE, PythonWin, Boa and VisualPython.

And now you're telling me about site.py! Where the hell did that come from.
I don't remember seeing anything about that!!! <wink>

Okay, okay, I found it in the Python Essential Reference (excellent,
excellent book). I'll have to read about it in order to reply.

Thanks again for all your help.

---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."

-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Saturday, June 09, 2001 2:27 AM
To: Patrick K. O'Brien
Cc: Python Tutor
Subject: Re: [Tutor] PYTHONSTARTUP under Win98

On Fri, 8 Jun 2001, Patrick K. O'Brien wrote:

> 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

Python only looks at PYTHONSTARTUP if you run it as an interactive
interpreter.  That is, only when you run it through the dos prompt.  It's
one of those details that the official tutorial sorta whispers vaguely
about... *grin*


"""
This file is only read in interactive sessions, not when Python reads
commands from a script, and not when /dev/tty is given as the explicit
source of commands (which otherwise behaves like an interactive session).
"""

http://www.python.org/doc/current/tut/node4.html#SECTION00423000000000000000
0



> 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.

Yes, you'll want to add the -s option to get IDLE to look at the
$PYTHONSTARTUP variable.


Another approach that we can use to get things to load automatically is to
add some lines to the "site.py", which makes changes for everyone,
regardless if we're running Python interactively or not.

Hope this helps!


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor