saved sys.path

Peter Hansen peter at
Tue Nov 2 14:41:47 CET 2004

Eric S. Johansson wrote:
> 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).

Most questions relating to this which haven't already been answered
by Alex can be answered by a perusal of the source.  It
makes good readin'...

Note that between PYTHONPATH and .pth files, possibly the addition
of a little file (see again, and the
ability to modify sys.path in the __main__ module of the app as
Alex suggests, you can do pretty much anything you think is a good
thing to do.


More information about the Python-list mailing list