[gdal-dev] can't import osgeo or gdal in python
William Kyngesburye
woklist at kyngchaos.com
Mon Sep 20 20:54:13 EDT 2010
For both of you, it now sounds like the _gdal.so might not be linking libgdal at all.
What does this return:
otool -L /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/osgeo/_gdal.so
On Sep 20, 2010, at 6:54 PM, Ivan Lucena wrote:
> Hi guys,
>
> Sorry to interrupt but I was having the exact same error as Jeff and I was following the discussion quite close.
>
> But I found a solution. I can get it to work as long as if I use python2.6:
>
> turtlebowl:~ ilucena$ python2.6
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from osgeo import gdal
>>>> drv = gdal.GetDriverByName("GTIFF")
>>>> print drv
> <osgeo.gdal.Driver; proxy of <Swig Object of type 'GDALDriverShadow *' at 0x1002596a0> >
>>>> ^D
>
> But if I use the default python, 2.7 - that I download binaries from python.org and run the installer from the dmg,
> that is what I got:
>
> turtlebowl:~ ilucena$ python
> Python 2.7 (r27:82508, Jul 3 2010, 20:17:05)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from osgeo import gdal
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/osgeo/__init__.py", line 21,
> in <module>
> _gdal = swig_import_helper()
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/osgeo/__init__.py", line 17,
> in swig_import_helper
> _mod = imp.load_module('_gdal', fp, pathname, description)
> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/osgeo/_gdal.so,
> 2): Symbol not found: _CPLDefaultErrorHandler
> Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/osgeo/_gdal.so
> Expected in: dynamic lookup
>
> Just like Jeff.
>
> This is my system:
>
> turtlebowl:~ ilucena$ sw_vers
> ProductName: Mac OS X
> ProductVersion: 10.6.4
> BuildVersion: 10F2061
>
> I build GDAL with and without macosx-framework that doesn't seem to affect.
>
> So, what does it means?
>
> Regards,
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"Mon Dieu! but they are all alike. Cheating, murdering, lying, fighting, and all for things that the beasts of the jungle would not deign to possess - money to purchase the effeminate pleasures of weaklings. And yet withal bound down by silly customs that make them slaves to their unhappy lot while firm in the belief that they be the lords of creation enjoying the only real pleasures of existence....
- the wisdom of Tarzan
More information about the gdal-dev
mailing list