Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

Helly John J. hellyj at ucsd.edu
Thu Feb 19 21:38:07 EST 2009


Hi.

You are correct about finding the module, Ned.  Thanks for that  
although I don't understand why it works.  However, there are  
complications.

1. Using '/usr/bin/python' and 'from osgeo import gdal' works but  
throws an error the first time it's invoked.

NeptuneDesk.local:/Volumes/B2_160GB/PALSAR_200902/Geotiffs>/usr/bin/ 
python
Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from osgeo import gdal
Python(21061) malloc: *** error for object 0xa00696d8: Non-aligned  
pointer being freed
*** set a breakpoint in malloc_error_break to debug
 >>> from osgeo import gdal
 >>>

2. Since I'm trying to use gdal_merge.py this causes a second attempt  
within gdal_merge.py, after the error above, to be made with the old  
(now wrong) syntax:

try:
     from osgeo import gdal
except ImportError:
     osgeo import gdal

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.

So, there are three issues:

1. the malloc error
2. the interaction with the gdal_merge.py error handling
3. the environment setup and where that's coming from.

Otherwise, everything's peachy.

Cheers.
--------------
John Helly, University of California, San Diego
San Diego Supercomputer Center,  Mail Code 0527
Scripps Institution of Oceanography, Climate, Atmospheric Science, and  
Physical Oceanography, Mail Code 0224
9500 Gilman Dr., La Jolla CA 92093
+01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) /  
URL (http://www.sdsc.edu/~hellyj)

On Feb 19, 2009, at 11:16 AM, Ned Deily wrote:

In article <nad-D1A1B2.10514619022009 at ger.gmane.org>,
Ned Deily <nad at acm.org> wrote:
> It looks like you have installed GDAL to the site-packages directory  
> of
> the Apple-supplied python 2.5 (which, for 10.5, is 2.5.1, not 2.4).
> That site-packages directory is /Library/Python/2.5. The Apple- 
> supplied
> python comes with a sym link from /usr/bin/python.  If you launch it,
> you'll probably find GDAL is there as expected.
>
> If you do want to use the python.org python, which is somewhat newer,
> you need to install its own version of setuptools/easy_install and use
> it to install GDAL to the site-packages directory of that python which
> is located here:
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
> pack
> ages.  The two python instances co-exist.  To install another
  easy_install, ensure the python.org python comes first on your
> PATH, then follow the instructions here:
>   <http://pypi.python.org/pypi/setuptools>

BTW, that easy_install will itself be installed into the bin directory
of the python.org python framework.  So to ensure you are using that
easy_install and that python, make sure that bin directory is on your
PATH before "/usr/bin", so, if necessary, something like:

export PATH="/Library/Frameworks/Python.framework/Versions/2.5/bin: 
$PATH"

-- 
Ned Deily,
nad at acm.org

--
http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090219/3a0ae2c8/attachment.html>


More information about the Python-list mailing list