[issue1431] pth files not loaded at startup

Giambattista Bloisi report at bugs.python.org
Tue Nov 13 21:47:26 CET 2007


Giambattista Bloisi added the comment:

This make sense. I hope I'm not annoying you.

But what I did was to read
(http://docs.python.org/inst/search-path.html) before reading
(http://docs.python.org/dev/library/site.html#module-site) as the latter
is referenced by the first via a html link.

The part of my interest of the first document says:
"The expected convention for locally installed packages is to put them
in the .../site-packages/ directory, but you may want to install Python
modules into some arbitrary directory. For example, your site may have a
convention of keeping all software related to the web server under /www.
Add-on Python modules might then belong in /www/python, and in order to
import them, this directory must be added to sys.path. There are several
different ways to add the directory.

The most convenient way is to add a path configuration file to a
directory that's already on Python's path, usually to the
.../site-packages/ directory. Path configuration files have an extension
of .pth, and each line must contain a single path that will be appended
to sys.path. (Because the new paths are appended to sys.path, modules in
the added directories will not override standard modules. This means you
can't use this mechanism for installing fixed versions of standard
modules.)"

So the gobolinux maintainer did: it added a file into this dir and it is
actually parsed and some dirs are appended to sys.path.

And after that the document says what already quoted:
"Paths can be absolute or relative, in which case they're relative to
the directory containing the .pth file. Any directories added to the
search path will be scanned in turn for .pth files. See site module
documentation for more information."

So why repeat here that some other directories will be scanned for pth
files, while you describe the accepted format for paths in .pth files?
If the only scanned directories are the ones already cited (a directory
that's already on Python's path), IMO there is no need to specify
further, unless you mean that the "single path appended to sys.path"
that you are describing "will be scanned *in turn* for .pth file".

On the other hand the second document doesn't say explicitly that the
*only* scanned directories are the ones derived from sys.prefix and
sys.exec_prefix. Indeed on darwin (Mac Os X) additional directories are
actually parsed.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1431>
__________________________________


More information about the Python-bugs-list mailing list