[gdal-dev] Python Bindings

Jeff Hamann jeff.d.hamann at gmail.com
Mon Jul 26 18:35:56 EDT 2010


I've built GDAL/OGR (1.7.2) with the following ./configure options 

$ ./configure \
 CC="gcc -arch i386" \
 CXX="g++ -arch i386" \
 OBJC="gcc -arch i386" \
 F77="gfortran -arch i386" \
 FC="gfortran -arch i386" \
  --with-pg=/usr/local/pgsql/bin/pg_config \
  --without-macosx-framework \
  --without-sqlite3 \
  --with-python

Even though I run on a mac, I really don't want to build with the framework. 

When I attempt to run a simple Python script:

#! /usr/bin/env python
from osgeo import gdal

I get the following:

Jeff-Hamanns-MacBook-Pro:scripts hamannj$ python pytest.py 
Traceback (most recent call last):
  File "pytest.py", line 2, in <module>
    from osgeo import gdal
  File "/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so, 2): Symbol not found: _CPLDefaultErrorHandler
  Referenced from: /Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so
Jeff-Hamanns-MacBook-Pro:scripts hamannj$ 

I know *nothing* about python. 

There are a bunch of these statements:

from osgeo import gdal
from osgeo import osr
import osgeo.gdalconst as gdalc
from optparse import OptionParser, OptionGroup
import binascii
import glob
import math
import numpy
import os
import sys

in the gdal2wktraster.py file that I eventually want to run, but I don't know enough about python to diagnose, debug, and correct these problems. 

Is this a python binding problem with gdal/ogr? 

When I ./configured gdal/ogr: I got the following results:

GDAL is now configured for i386-apple-darwin10.4.0

  Installation directory:    /usr/local
  C compiler:                gcc -arch i386  -g -O2
  C++ compiler:              g++ -arch i386  -g -O2

  LIBTOOL support:           yes

  LIBZ support:              external
  GRASS support:             no
  CFITSIO support:           no
  PCRaster support:          internal
  NetCDF support:            yes
  LIBPNG support:            internal
  LIBTIFF support:           internal (BigTIFF=yes)
  LIBGEOTIFF support:        internal
  LIBJPEG support:           internal
  8/12 bit JPEG TIFF:        yes
  LIBGIF support:            internal
  OGDI support:              no
  HDF4 support:              no
  HDF5 support:              no
  Kakadu support:            no
  JasPer support:            no
  ECW support:               no
  MrSID support:             no
  MSG support:               no
  GRIB support:              yes
  EPSILON support:           no
  cURL support (wms/wcs/...):yes
  PostgreSQL support:        yes
  MySQL support:             no
  Ingres support:            no
  Xerces-C support:          no
  NAS support:               no
  Expat support:             yes
  ODBC support:              no
  PGeo support:              no
  PCIDSK support:            internal
  OCI support:               no
  GEORASTER support:         no
  SDE support:               no
  DODS support:              no
  SQLite support:            no
  SpatiaLite support:        no
  DWGdirect support          no
  INFORMIX DataBlade support:no
  GEOS support:              yes
  VFK support:               yes

  Mac OS X Framework :       no

  SWIG Bindings:          python 

  Statically link PROJ.4:    no
  enable OGR building:       yes
  enable pthread support:    no
  hide internal symbols:     no

Jeff-Hamanns-MacBook-Pro:gdal-1.7.2 hamannj$ 



Jeff Hamann
jeff.d.hamann at gmail.com





More information about the gdal-dev mailing list