This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gotgenes
Recipients gotgenes
Date 2010-01-20.20:19:20
SpamBayes Score 1.9884457e-07
Marked as misclassified No
Message-id <1264018763.75.0.862537731081.issue7744@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2010-01-20 20:19:23gotgenessetrecipients: + gotgenes
2010-01-20 20:19:23gotgenessetmessageid: <1264018763.75.0.862537731081.issue7744@psf.upfronthosting.co.za>
2010-01-20 20:19:22gotgeneslinkissue7744 messages
2010-01-20 20:19:21gotgenescreate