[New-bugs-announce] [issue7744] Allow site.addsitedir insert to beginning of sys.path
Chris Lasher
report at bugs.python.org
Wed Jan 20 21:19:23 CET 2010
New submission from Chris Lasher <chris.lasher at gmail.com>:
Would it be possible to add an extra option to site.addsitedir so that it left-appends (inserts at the beginning of the list rather than the end of the list) to sys.path the new path?
The use case for this is that sometimes the user has local versions of packages and modules they would prefer to use over versions installed system-wide. Since Python searches for packages and modules in the order given by sys.path, inserting the new path(s) at the beginning of sys.path. This leads to hack-ish work-arounds, such as the one given by http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
If there was an option to left-append with site.addsitedir, it would really help in cases such as these.
Note that I'm not certain at the moment how best to add additional paths that are found in .pth files, i.e., whether to insert them at the beginning as well, or insert them between the initial path and the original paths (the paths that existed before site.addsitedir is called).
----------
components: Library (Lib)
messages: 98084
nosy: gotgenes
severity: normal
status: open
title: Allow site.addsitedir insert to beginning of sys.path
type: feature request
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7744>
_______________________________________
More information about the New-bugs-announce
mailing list