[Tutor] PYTHONPATH: where to set on Win9x

Christian Mascher mascher@crg.ha.nw.schule.de
Wed, 13 Jun 2001 22:45:11 +0200


Hello everyone,

I've been following the recent postings on implementing a
startup-configuration of some sorts, perhaps loading some modules
(pydoc) or setting up the path to arbitrary extra module-directories (my
private modules). As far as I understood the matter, the
module-search-path (shown with 'sys.path') where Python looks for and is
able to find modules must (?) be set via the environment variable
PYTHONPATH. 

But that doesn't seem to be the whole story on windows, because I can
run python and import all standard modules with no explicit PYTHONPATH
set in the environment. (During installation the necessary paths must
have been hardwired into the registry.  For the same reason I can start
idle by "executing" idle.pyw from the shell (explorer) right?).

So I guess I only have to use PYTHONPATH for having my personal
directories turn up in sys.path, is that right? Meaning I only need to
put
set PYTHONPATH=d:\mypython 
in autoexec.bat to include that directory. It works, but is it "the
right way" or did I miss a point?

By the way, is the global autoexec.bat really the best place for putting
this? Normally, when I use a console-started compiler (like javac for
instance), I have an extra .bat-script setting the appropriate
environment-variables only when opening the shell (DOS-box) dedicated to
Java or whatever. So it is possible to add environment variables later.
Could/should this be done for the python shell as well? One could of
course append to sys.path in a standard startupscript, but then I have
to set PYTHONSTARUP first, yes?

Hope I'm not asking the same questions Patrick O'Brien and Daniel Yoo
just sorted out, but I'm really still confused about the issue.

Thanks in advance,
Christian