[Gdal-dev] import _gdal issue

Simon Hope SimonH at geobiz.co.nz
Mon Oct 15 16:28:20 EDT 2007


Chris('s),

Cheers for your help - I got feature server to read the shapefile once I
rebooted the machine which seemed to help Apache see the python path.

Cheers

Simon

-----Original Message-----
From: Christopher Barker [mailto:Chris.Barker at noaa.gov] 
Sent: Wednesday, 10 October 2007 12:46 p.m.
To: Christopher Schmidt
Cc: gdal-dev at lists.maptools.org; Simon Hope
Subject: Re: [Gdal-dev] import _gdal issue

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
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev








More information about the Gdal-dev mailing list