a module.pth question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jul 15 00:26:03 EDT 2008


En Mon, 14 Jul 2008 08:26:49 -0300, oyster <lepto.python at gmail.com>  
escribi�:

> My py24 is installed in h:\python24
> I installed pyglet(http://pyglet.org/) in
> H:\pure_pylib\Multimedia\pyglet-1.0\, if I do
> [code]
>>>> import sys
>>>> sys.path.append(r'H:\pure_pylib\Multimedia\pyglet-1.0')
>>>> import pyglet
> [/code]
> it is ok.
>
> but if I created h:\pure_pylib\pyglet.pth file, which containts
> [code]
> Multimedia\pyglet-1.0
> [/code]
>
> then
> [code]
>>>> import sys
>>>> sys.path.append(r'h:\pure_pylib')
>>>> import pyglet
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named pyglet

.pth files are searched only when Python starts (specifically: when the  
site.py script is executed). If you later add a directory containing a  
.pth file, it is *not* processed.
Put your .pth files inside a directory *already* in the search path - see  
http://docs.python.org/lib/module-site.html

-- 
Gabriel Genellina




More information about the Python-list mailing list