[GRASS-dev] PYTHONPATH question

Glynn Clements glynn at gclements.plus.com
Sun Jul 27 19:01:30 EDT 2008


Michael Barton wrote:

> Any idea why the following PYTHONPATH in my .profile works fine for  
> GRASS finding packages like MatPlotLib and a version with the site- 
> packages entry last does not?
> 
> PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages:/Library/Frameworks/Python.framework/Versions/ 
> 2.5/lib/python25.zip:/Library/Frameworks/Python.framework/Versions/2.5/ 
> lib/python2.5:/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/plat-darwin:/Library/Frameworks/Python.framework/Versions/ 
> 2.5/lib/python2.5/plat-mac:/Library/Frameworks/Python.framework/ 
> Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages:/Library/ 
> Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk:/Library/ 
> Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib- 
> dynload:"$PYTHONPATH

Why do you have all of your Python system directories in PYTHONPATH? 
Those should already be in sys.path.

FWIW, on Gentoo, the only directory which is added to PYTHONPATH by
the OS configuration is /usr/lib/portage/pym ("portage" is Gentoo's
package manager, and it's written mainly in Python).

I suggest completely unsetting PYTHONPATH, and seeing what problems
(if any) that causes.

> I had to modify this from the one that the Mac Python installation  
> sets to put site-packages first. The Python interpreter has no problem  
> with the path either way.  Does something in the grass Python parser  
> stop reading this path if it hits non-existent directories?

No.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list