organizing your scripts, with plenty of re-use

bukzor workitharder at gmail.com
Mon Oct 19 20:45:59 EDT 2009


On Oct 15, 4:30 pm, bukzor <workithar... at gmail.com> wrote:
> On Oct 13, 3:20 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> wrote:
>
>
>
>
>
> > 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 [1]). 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?http://docs.python.org/library/site.html
>
> 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?

I thought this was one of the least objectionable of my posts.

Does anyone know how to find a discussion of the .pth implementation?




More information about the Python-list mailing list