pth files - can they prepend to sys.path?

Alex Martelli aleax at aleax.it
Fri Dec 28 10:42:17 EST 2001


"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1009549952.9614.python-list at python.org...
>
> Is it possible to force a directory mentioned in a .pth file to be
inserted
> at the beginning of sys.path instead of appended to the end?

Only by editing your site.py, I fear (or, by doing it in siteconfigure.py,
probably better).  Function site.addpackage, as it stands, uses
sys.path.append, so directories thus added won't get to the start
of sys.path, but always to the end.


Alex






More information about the Python-list mailing list