[GRASS-dev] PYTHONPATH question

William Kyngesburye woklist at kyngchaos.com
Tue Jul 29 12:37:55 EDT 2008


On Jul 29, 2008, at 11:22 AM, Michael Barton wrote:

> GRASS 7.0.svn (Spearfish60_test):~ > histogram_mpldemo.py
>
> ********* sys.argv ***********
>
> /Applications/Grass/GRASS-7.0.app/Contents/MacOS/scripts/ 
> histogram_mpldemo.py
>
> ********* sys.path ***********
>
> /Applications/Grass/GRASS-7.0.app/Contents/MacOS/scripts
> /Library/Python/2.5/site-packages/GDAL-1.5.2-py2.5-macosx-10.5- 
> i386.egg
> /Applications/Grass/GRASS-7.0.app/Contents/MacOS/etc/python
> /Users/cmbarton
> /usr/local/lib/wxPython-unicode-2.8.8.1/lib/python2.5/site-packages
> /usr/local/lib/wxPython-unicode-2.8.8.1/lib/python2.5/site-packages/ 
> wx-2.8-mac-unicode
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python25.zip
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/plat-darwin
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/plat-mac
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/plat-mac/lib-scriptpackages
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/ 
> python
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/lib-tk
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/lib-dynload
> /Library/Python/2.5/site-packages
> /usr/local/lib/wxPython-unicode-2.8.8.1/lib/python2.5
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/ 
> python/PyObjC
>

> Traceback (most recent call last):
>  File "/Applications/Grass/GRASS-7.0.app/Contents/MacOS/scripts/ 
> histogram_mpldemo.py", line 104, in <module>
>    import matplotlib
> ImportError: No module named matplotlib
> GRASS 7.0.svn (Spearfish60_test):~ >

[coming out of lurking on this one]

It looks like, when run from a python script in GRASS, you're getting  
the system python.

Yet, when you run python itself from GRASS, you get the python.org  
Python.  What is the shebang line (first line) in your python script,  
it may be pointing to the system python?


On Jul 27, 2008, at 7:40 PM, Michael Barton wrote:

>> Is "python" the actual executable, or is it a front-end script?
>
> /usr/bin/python and /usr/local/bin/python are symlinks to /Library/ 
> Frameworks/.../python2.5, which is an executable. I've checked and  
> this is the only "python" in my path

/usr/bin/python should be a symlink to the SYSTEM python.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole.  Now what  
does that remind me of?  Ah, yes - life."

- Marvin




More information about the grass-dev mailing list