[gobolinux-users] $pythonpath
Hisham Muhammad
hisham.hm at gmail.com
Thu Nov 29 06:35:43 NZDT 2007
On Nov 27, 2007 6:26 PM, Carlo Calica <carlo at calica.com> wrote:
> On 11/14/07, Giambattista Bloisi <giamby at infinito.it> wrote:
> >
> > My problem was yet another I wanted python to scan for pth file that were in
> > /System/Links/Libraries/python2.5/site-packages/ because some python modules (PyGObject)
> > installed there .pth files in the hope they were actually scanned.
> > I found that I could scan additional path for pth files by adding a line of the
> > following form to gobolinux.pth:
> > import site; site.addsitedir('/System/Links/Libraries/python2.5/site-packages/', set())
> >
> > This should be ok with docs and future versions of python as site doc says that lines
> > starting with "import " are actually executed.
> >
> > I think that this could be a final solution for gobolinux distro. In this way when you have
> > to add a dir in the search path all you have to do in the recipe is to add a .pth file in
> > the appropriate Resources subdir. It is then symlinked to
> > /System/Links/Libraries/python<major.minor>/site-packages/ and it works as we registered this path for pth file scanning.
> >
>
> I've had time problem countless times. I usually brute force it by
> adding a symlink in /Programs/Python/.../.../ but this is much better.
> Could this be added to the Python recipe?
>
> add to gobolinux.pth
> import site; site.addsitedir('/System/Links/Libraries/python2.5/site-packages/',
> set())
>
> Anyone see any problems doing this?
Mmm, I'm not sure if I got it.
My gobolinux.pth currently looks like this:
/System/Links/Libraries/python2.3/site-packages/
/System/Links/Libraries/python2.4/site-packages/
/System/Links/Libraries/python2.5/site-packages/
Are you suggesting for it to look like this? (paths mixed with Python code?)
/System/Links/Libraries/python2.3/site-packages/
/System/Links/Libraries/python2.4/site-packages/
/System/Links/Libraries/python2.5/site-packages/
import site; site.addsitedir('/System/Links/Libraries/python2.5/site-packages/',set())
In any case, if I do this, I get:
'import site' failed; use -v for traceback
everytime I launch Python. Running 'import site' directly from Python
gives me a long stack trace, with the error:
RuntimeError: maximum recursion depth exceeded
I tried removing the other paths from the file, and clearing the
$PYTHONPATH variable, but I still get the same error. Does anybody
have any idea?
-- Hisham
More information about the gobolinux-users
mailing list