How to extend sys.path on Win9x permanently?
Peter Hansen
peter at engcorp.com
Tue Jan 30 02:47:46 EST 2001
Martin Bless wrote:
>
> Python20, Win98, PythonWin
>
> (1) I'd like Python.exe/DOS AND Python in PythonWin to start
> up with an extended sys.path, having my own lib added, as if a
> sys.path.append('c:\\mylib') had already been performed.
> How can I add the extra path permanently?
Note certain, but it's likely that site.py is imported even under
PythonWin. If that's true, and it should be easy to test, just
create a file in your Python directory with an extension .PTH,
and place within it the name of the directory you want added
to sys.path.
For example, in my directory n:\a\python, I have a file 'lib.pth'
that contains the single line 'n:\lib\python'. Every time I
run a script, it adds this to the end of my sys.path.
Beats editing the registry, too.
> (2) Here's what sys.path is on my machine. Where is this defined?
> Registry?
> *.ini?
> Hard coded?
Yes, registry. Grim but possibly the only place PythonWin can
find it. Not sure.
> (3) I'd hate having to put something like "set $PYTHONPATH=..." into
> AUTOSTART.BAT, since DOS environment space is very limited.
Doesn't your Windows support adding lines to config.sys, such as:
shell=c:\command.com /p /e:4096
which would extend environment space to 4K?
More information about the Python-list
mailing list