.pth - howto?

flippetigibbet sjhalpin at gmail.com
Thu Nov 17 23:00:40 EST 2005


I was thinking that if I create:
\documents and settings\user\My
Documents\my\scripts\py\dirname\__init__.py
and a .pth file in site-packages with something like:
\documents and settings\user\My Documents\my\scripts\py\dirname
then my script __init__.py should run when I import dirname
but it doesn't

My team of trigger-happy lawyers is currently analyzing "Installing
Python Modules", which says:
Paths can be absolute or relative, in which case they're relative to
the directory containing the .pth file.

I've tried specifying the .pth file with
r'\documents and settings\user\My Documents\my\scripts\py\dirname'
\DOCUME~1\user\MyDocu~1\my\scripts\py\dirname
/doceme~1/user/MYDOCU~1/MY/SCRIPTS/PY/DIRNAME
but I can't seem to get python 2.4 to pick up an absolute path on
windows.

I know I could put my scripts in site-packages, but I quite like the
idea of keeping my scripts and 3rd party scripts separate. Also, I
would prefer not to add "\documents and settings\user\My
Documents\my\scripts\py" to the PYTHONPATH, because as soon as I
install some 3rd party, I tend to write a 'play' script to run it, so I
only want the stuff I specify on the path.

So how do I configure an absolute path in a .pth file on windows?




More information about the Python-list mailing list