pth files - can they prepend to sys.path?
Skip Montanaro
skip at pobox.com
Fri Dec 28 15:00:50 EST 2001
Skip> Is it possible to force a directory mentioned in a .pth file to be
Skip> inserted at the beginning of sys.path instead of appended to the
Skip> end?
Michael> You realise the handling of .pth files is done in site.py?
No, actually, I wasn't. Thanks for pointing that out. I only recently
realized they were useful outside of the package facility, so hadn't ever
investigated them.
Michael> The answer seems to be no, though presumably there's nothing
Michael> stoppoing you supporting .pthplus files in a sitecustomize.py.
In looking at the code (now that I know where to look), it seems to me the
more logical thing to do would be to add an optional second word to the
directory line that specifies whether to prepend or append the directory
(the default obviously being to append):
# stick at the start
/usr/local/lib/automatrix/python prepend
# append to the end
/usr/local/lib/automatrix/python append
# append - same as current
/usr/local/lib/automatrix/python
Skip
More information about the Python-list
mailing list