How to insert my own module in front of site eggs?

Paul Rudin paul.nospam at rudin.co.uk
Fri Nov 18 00:54:15 EST 2011


Roy Smith <roy at panix.com> writes:

> In article <874ny2fzn6.fsf at no-fixed-abode.cable.virginmedia.net>,
>  Paul Rudin <paul.nospam at rudin.co.uk> wrote:
>
>> 
>> Maybe I'm missing something - but if I want to do this I just mess about
>> with sys.path at the top of my python script/program. Always seems to
>> work... is there a situation in which it doesn't?
>
> What if the first import of a module is happening inside some code you 
> don't have access to?

If you change sys.path first - before you do any imports - then any
other imports will surely come from the first thing on sys.path (unless
something else you import also changes sys.path)?






More information about the Python-list mailing list