organizing your scripts, with plenty of re-use
workitharder at gmail.com
Fri Oct 16 01:30:02 CEST 2009
On Oct 13, 3:20 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> En Tue, 13 Oct 2009 17:38:44 -0300, Buck <workithar... at gmail.com> escribió:
> > The only way to get your packages on the PYTHONPATH currently is to:
> > * install the packages to site-packages (I don't have access)
> > * edit the PYTHONPATH all users' environment (again, no access)
> > * create some boilerplate that edits sys.path at runtime (various
> > problems in previous post)
> > * put your scripts directly above the package (this seems best so
> > far, but forces a flat hierarchy of scripts)
> Not exactly - in short, you have to place the package under some directory
> that is eventually listed in sys.path.
> By default, one of such directories is site-packages, but there are also
> per-user directories. On Windows, %APPDATA%\Python\PythonNN\site-packages
> (see PEP 370 ). If you don't want to copy the package there, you can
> even add a .pth file and it will be processed.
The .pth files are intriguing. Is this the best reference?
My current solution very closely resembles the .pth system, but uses
the scripts' directory and accepts relative paths.
If I'm reading the doc correctly, the .pth system currently doesn't
support either of these. Does anyone know of the rationale for this?
More information about the Python-list