Permanently Adding A Directory to Pythonpath
Alex Martelli
aleaxit at yahoo.com
Tue May 29 17:36:03 EDT 2001
"Bengt Richter" <bokr at accessone.com> wrote in message
news:3b13f162.640694710 at wa.news.verio.net...
...
> Well, sys.path already has methods by its nature as a [] thingy,
> so why not just use those? What you'd need is a module that
> got imported by the main on startup. Being a pythonewbie,
> I'm not sure something like that doesn't already exist ;-)
Yes, it's site.py in the lib directory. In turn, it imports
sitecustomize, so you can do your tweaks there.
> E.g., what if starting the interpreter would automatically
> import, e.g., config.py it it existed in the PYTHONHOME
> directory? That would seem pretty extendable and flexible.
>
> Maybe whatever is reading .PTH files is it? Is it defined
> in a user-modifiable place?
I wouldn't suggest changing site.py (the one that's
reading the .pth files), but tweaks in sitecustomize.py
should work just as well.
Alex
More information about the Python-list
mailing list