[Gdal-dev] import _gdal issue

Christopher Barker Chris.Barker at noaa.gov
Tue Oct 9 19:35:59 EDT 2007


Christopher Schmidt wrote:
> On Wed, Oct 10, 2007 at 10:22:25AM +1300, Simon Hope wrote:
>>>>> import _gdal
>> And don't get any errors and have access to the members on that module.
> 
> Pythonwin is probably using a different PYTHONPATH than apache is.
> Somewhere in that path _gdal is probably included. Others can probably
> comment more directly, but I would do something like:
> 
> import _gdal
> print _gdal
> 
> Which should give output like <module 'gdal' from
> 'C:\SomethingOrOther\gdal.dll'> or something similar.
> 
> Once you've done that, you should be able to add the following to the
> FeatureServer cgi:
> 
> sys.path.append("C:\SomethingOrOther")

It's worth a try, but something is odd. From that traceback:

   File "C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\featureserver\FeatureServer\DataSource\OGR.p
y", line 2, in ?
     import ogr, osr
   File "C:\Python24\Lib\site-packages\ogr.py", line 33, in ?
     import _gdal

so it looks like ogr.py was found, but _gdal.pyd was not. They should 
both be in site_packages.

Take a look at C:\Python24\Lib\site-packages, and see what's there. 
there should be something like:


ogr.py
ogr.pyc
osr.py
osr.pyc
_gdal.pyd
gdal.py
gdal.pyc
gdalconst.py
gdalconst.pyc
gdalnumeric.py
gdalnumeric.pyc


in other words, _gdal.pyd should be in the same place as ogr.py, and 
therefor importable.

By the way in future next releases this should be a bit cleaned up -- 
with eveything in site_packages/osgeo/

Hopefully these problems will be easier to solve then.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Gdal-dev mailing list