Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

Ned Deily nad at acm.org
Fri Feb 20 04:02:41 CET 2009


In article <2FE1A73A-5BDD-45CD-8323-CCDF68DF3269 at ucsd.edu>,
 "Helly John J." <hellyj at ucsd.edu> wrote:
>[...]
> 3.  I changed the gdal_merge.py code so it uses the correct syntax  
> even after the error but then find that I get the original 'no module'  
> error, I think, because gdal_merge.py starts with the line:
> 
> #!/usr/bin/env python
> 
> I don't understand this usage but when I run it alone (i.e., /usr/bin/ 
> env) I see that it forces the PATH, and the environment in general, to  
> be something different than what I have set in my .bash_profile.  For  
> example, it puts
> 
> PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:
> 
> in the beginning in front of /usr/bin which I had moved up in the path  
> in my .bash_profile.  I overcame this by getting rid of /usr/bin/env  
> and substituting /usr/bin/python.

See <http://en.wikipedia.org/wiki/Shebang_(Unix)>.

The idea behind /usr/bin/env usage is to allow scripts to get around 
absolute paths and to be able to find the interpreter for the script by 
using the search order of $PATH.  So, if the script with /usr/bin/env 
python was invoking the wrong python, it sounds like your $PATH wasn't 
really what you thought it was, despite changing your .bash_profile.  
Did you start a new terminal session or login shell?  What does "echo 
$PATH" say?

> So, there are three issues:
> 
> 1. the malloc error
> 2. the interaction with the gdal_merge.py error handling

No suggestions on the first two, other than to perhaps install 
easy_install and GDAL and friends using the python.org 2.5 and/or to ask 
in a more specialized forum.

> Otherwise, everything's peachy.

Good luck!

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list