organizing your scripts, with plenty of re-use

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Oct 13 18:20:28 EDT 2009


En Tue, 13 Oct 2009 17:38:44 -0300, Buck <workitharder 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.

[1] http://www.python.org/dev/peps/pep-0370/

-- 
Gabriel Genellina




More information about the Python-list mailing list