David Lyon wrote:
On Mon, 18 May 2009 14:34:33 +0200, Philipp Hagemeister <phi...@phihag.de>
wrote:
Yes, but that processing will add /example/ to sys.path, right?

It actually works the other way around. The directories listed in
sys.path are scanned for .pth files.

You can add packages by listing them inside a .PTH.

I'm expecting .pth files in the current directory to be be processed,
according to docs/install/. Christian Heimes already pointed out this is
not the case; so I'm wondering whether this is a mistake in the
documentation or just my faulty logic.

Perphaps you don't understand them yet.

.PTH files are for adding run-time packages.

May I ask why you are playing with .PTH files? they are a fairly
advanced sort of concept for describing where packages are located
to the python interpreter.

If you are using .PTH files... you should be using "import .." inside your code..


David: I believe you're at least over-stating the case for .pth
files as "fairly advanced" and "for adding run-time packages".

According to http://docs.python.org/install/index.html and my
own reasonably long experience of them, they're just a way of
getting extra paths into sys.path. Those paths could, of course,
support adding packages, but they might not. My own has a mixture
of network directories which contain a bunch of commonly-used
modules, and entries in my subversion checkouts dir each of which
may or may not refer to a package.

The docs referred to above do indeed say "add a path configuration file to a directory that’s already on Python’s path" but until I
saw Christian H's post just now, I'd never bothered to understand
exactly what the mechanism was: I just stick site.pth into c:\pythonxx
and it works for me.

TJG

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to