saved sys.path

Eric S. Johansson esj at harvee.org
Mon Nov 1 09:28:58 EST 2004


Alex Martelli wrote:
> Bengt dePaulis <bdp003 at hotmail.com> wrote:
> 
> 
>>I have a local directory that I want to include in my sys.path
>>
>>How to save it permanently?
> 
> 
> Add to the site-packages directory of your Python instalation a textfile
> named for example bengt.pth (name doesn't matter, extension does, and
> must be lowercase) with the line of text:
> 
> /path/to/the/directory/you/mant

one of the things I've been bothered with using Python for larger 
applications is path manipulation.  For example, how does one create the 
search path necessary to find your own modules if you do not wish 
pollute site-packages with your private code.

the path file looks like this might be a good solution in preference to 
modifying sys.path in your code.  Are there any scope or limitation 
rules for this path modifier?  Can this modification be made specific to 
an application or is the new path visible to the entire world (which 
reintroduces the namespace pollution problem).

---eric




More information about the Python-list mailing list