How do I add permanently to Pythons sys.path?

Aaron "Castironpi" Brady castironpi at
Tue Sep 16 22:53:48 CEST 2008

On Sep 16, 3:16 pm, cnb <circularf... at> wrote:
> On Sep 16, 7:49 pm, "Aaron \"Castironpi\" Brady"
> > > Now I have my personal programs in C:/Python25/Progs/
> > > How do I add so that I can just do "import somefile" from anywhere in
> > > that directory in the interpreter and it can load files from other
> > > folders in that directory.
> > Add a file: \Lib\site-packages\locals.pth
> > with contents, path to the directory you want to add (/python25/progs/)
> And we have a winner!
> Now it works. Both doing import and loading form fiel with C-c C-l
> However jsut including C:/Python/Progs wasn't enough. I had to add the
> folder inside that that contains the files i needed.
> so how do i add all files within progs? is there something like C:/
> python25/progs/* ?

You have:

c:/python/progs/def/ in progs   (empty...) in abc in def

c:/python/site-packages/lib/  which contains:

You don't need the subdirectories.  You can do:

import abc
import abc.filea
from abc import filea

More information about the Python-list mailing list