[Pythonmac-SIG] RE: Localized project folder and .pth?
Bob Ippolito
bob at redivi.com
Fri Apr 1 06:42:13 CEST 2005
On Mar 31, 2005, at 11:32 PM, Lee Cullens wrote:
> OS X 10.3.8 with the Mac Python add ons (and new to both Mac and
> Python)
>
> To keep a learning project together I'm creating my module files in a
> folder within my account. Not using any fancy IDE yet I brought up
> PythonIDE and (of course) the first import of one of my modules
> failed. Having read about a .pth file I created a one liner with a
> full path to my learning project folder and then looked around for
> where to put it. I noticed other .pth files in /Library/Python/2.3 so
> I put it there and now the imports of my modules work.
>
> The point here is though this worked, is this the correct (normally
> accepted) way to do such. That is, keeping a project's "unique"
> modules in an isolated folder (or folder structure), creating a .pth
> file to such and placing that file in /Library/Python/2.3?
Yes it's a perfectly good way to do it. I would go as far as saying
the best way of doing it, especially on Mac OS X.
If you want to localize this to your specific account,
~/Library/Python/2.3/site-packages is also a respected location for
doing it (you will probably need to create this folder). When using
the Python 2.4.1 build I would use ~/Library/Python/2.4/site-packages
-- the normal site-packages path is deep within the framework.
The tilde (~) means your home directory, if you're not familiar with
the unix terminology. Also note that Finder's cmd-shift-G "Go to
folder..." dialog also knows about tilde.
> If someone has already elaborated on this subject then please just
> point me at the piece.
http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-
python-development/
If you poke around elsewhere on my blog, and on
http://pythonmac.org/wiki/ (particularly the FAQ) you should find some
interesting stuff...
-bob
More information about the Pythonmac-SIG
mailing list