Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

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


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

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

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 this causes a second attempt  
within, after the error above, to be made with the old  
(now wrong) syntax:

     from osgeo import gdal
except ImportError:
     osgeo import gdal

3.  I changed the 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 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


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 error handling
3. the environment setup and where that's coming from.

Otherwise, everything's peachy.

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) /  

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

In article <nad-D1A1B2.10514619022009 at>,
Ned Deily <nad at> 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, 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 comes first on your
> PATH, then follow the instructions here:
>   <>

BTW, that easy_install will itself be installed into the bin directory
of the 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: 

Ned Deily,
nad at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list