[GRASS-dev] PYTHONPATH question

Michael Barton michael.barton at asu.edu
Tue Jul 29 12:54:27 EDT 2008


On Jul 29, 2008, at 9:37 AM, William Kyngesburye wrote:

> [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.
>


Weird. When I do 'show original' for /usr/bin/python, it shows as a  
symlink to

/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python

...which is a symlink to /System/Library/Frameworks/Python.framework/ 
Versions/2.5/bin/python2.5

BUT, if I start it...

cmb-MBP-2:~ cmbarton$ python
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>
cmb-MBP-2:~ cmbarton$ /usr/bin/python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> ^D
cmb-MBP-2:~ cmbarton$ /usr/bin/python2.5
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>
cmb-MBP-2:~ cmbarton$ /usr/local/bin/python
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>

So it IS the shebang at the top.

So what to do to make this work?

#!/usr/bin/env python ????

This works on my Mac. Does it work for others?

Michael






More information about the grass-dev mailing list