[Pythonmac-SIG] .PTH files?

Schollnick, Benjamin Benjamin.Schollnick at usa.xerox.com
Wed Dec 17 12:56:42 EST 2003


> This would work, and there's even a way to do this without touching 
> sitecustomize.py: any line in a ".pth" file that starts with 
> "import " 
> is simply executed. So there's nothing to stop us from 
> creating a file 
> macpython-update-23.pth with the contents
> import sys; if sys.version_info[:3] == (2, 3, 0): sys.path.insert(1, 
> "/Library/Python/2.3/macpython-update-23")
> (this is the trick I wasn't going to tell you about:-)

<.Blink.> 

You can do that?  I admit, I have not dug for information on the .PTH
files...  But I thought that they had one purpose, and only one way to be
used....

Place a directory path in the .PTH file, so that you can import something
that was not in the site-lib, or lib path.

Is there more advanced ways to use .pth files?  I don't recall seeing the
.pth files really documented anywhere?  Did I miss something?

		- Benjamin



More information about the Pythonmac-SIG mailing list