[GRASS-dev] PYTHONPATH question

Michael Barton michael.barton at asu.edu
Tue Jul 29 16:11:17 EDT 2008



voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Jul 29, 2008, at 1:03 PM, Glynn Clements wrote:

>> So it IS the shebang at the top.
>
> Is "python" an alias? In the shell, type "alias python" and
> "type python".
>

anthgradpc7:~ cmbarton$ alias python
-bash: alias: python: not found
anthgradpc7:~ cmbarton$ type python
python is hashed (/Library/Frameworks/Python.framework/Versions/ 
Current/bin/python)


>> So what to do to make this work?
>>
>> #!/usr/bin/env python ????
>>
>> This works on my Mac. Does it work for others?
>
> The use of /usr/bin/env is a hack to make it look for "python" in
> $PATH. The #! syntax requires an absolute path, but there's no telling
> where python will be installled (Python isn't part of POSIX, so you
> can't rely up on it being installed in /usr/bin).
>
> The actual purpose of env is to run commands with a modified
> environment. The reason it's being used here (without any environment
> changes) is just because it allows the program to run to be specified
> as a name rather than a full path, and because /usr/bin/env will
> always be available.

So is this OK? If so, we should put this in the WIKI. Is there a  
better alternative, since we don't know where python is going to be  
installed?

Michael


More information about the grass-dev mailing list