<div>Hi list,</div>
<div> </div>
<div>I am trying to get the python bindings to gdal to work on windows and Python 2.5.1 to connect to Postgis. I know everything is packaged in FWTools, and I have it working that way. But I want to use the shapely package, which requires python 2.4+</div>
<div>So I extracted the gdalwin32exe150.zip and added the bin dir of it to my path and created the GDAL_DATA env variable.</div>
<div>I downloaded the ogr_PG.dll and added it to the bin\gdalplugins dir. The path to the pg_config.exe is also in my path variable (not sure if that is important)</div>
<div>I grabbed the GDAL-1.5.0.win32-py2.5.exe from <a href="http://pypi.python.org/pypi/GDAL">http://pypi.python.org/pypi/GDAL</a> and installed that.</div>
<div>If I open a shapefile that is ok, but if I try to open my Postgis dataset I get a NoneType error back:</div>
<div> </div>
<div>>>> from osgeo import ogr<br>>>> dir(ogr)<br>['CreateGeometryFromGML', 'CreateGeometryFromJson', 'CreateGeometryFromWkb', 'CreateGeometryFromWkt', 'DataSource', 'DataSource_swigregister', 'DontUseExceptions', 'Driver', 'Driver_swigregister', 'Feature', 'FeatureDefn', 'FeatureDefn_swigregister', 'Feature_swigregister', 'FieldDefn', 'FieldDefn_swigregister', 'Geometry', 'Geometry_swigregister', 'GetDriver', 'GetDriverByName', 'GetDriverCount', 'GetOpenDS', 'GetOpenDSCount', 'Layer', 'Layer_swigregister', 'ODrCCreateDataSource', 'ODrCDeleteDataSource', 'ODsCCreateLayer', 'ODsCDeleteLayer', 'OFTBinary', 'OFTDate', 'OFTDateTime', 'OFTInteger', 'OFTIntegerList', 'OFTReal', 'OFTRealList', 'OFTString', 'OFTStringList', 'OFTTime', 'OFTWideString', 'OFTWideStringList', 'OJLeft', 'OJRight', 'OJUndefined', 'OLCCreateField', 'OLCDeleteFeature', 'OLCFastFeatureCount', 'OLCFastGetExtent', 'OLCFastSetNextByIndex', 'OLCFastSpatialFilter', 'OLCRandomRead', 'OLCRandomWrite', 'OLCSequentialWrite', 'OLCTransactions', 'Open', 'OpenShared', 'RegisterAll', 'SetGenerate_DB2_V72_BYTE_ORDER', 'UseExceptions', '__builtins__', '__doc__', '__file__', '__name__', '_newclass', '_object', '_ogr', '_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic', 'new', 'new_instancemethod', 'osr', 'wkb25Bit', 'wkbGeometryCollection', 'wkbGeometryCollection25D', 'wkbLineString', 'wkbLineString25D', 'wkbLinearRing', 'wkbMultiLineString', 'wkbMultiLineString25D', 'wkbMultiPoint', 'wkbMultiPoint25D', 'wkbMultiPolygon', 'wkbMultiPolygon25D', 'wkbNDR', 'wkbNone', 'wkbPoint', 'wkbPoint25D', 'wkbPolygon', 'wkbPolygon25D', 'wkbUnknown', 'wkbXDR']<br>
>>> ogr.RegisterAll()<br>>>> ds = ogr.Open('PG:dbname=postgis host=localhost', update = 1 )<br>>>> print ds.GetLayerCount()<br>Traceback (most recent call last):<br> File "<interactive input>", line 1, in <module><br>
AttributeError: 'NoneType' object has no attribute 'GetLayerCount'<br>>>> ds = ogr.Open(r'C:\arcgis\ArcTutor\ArcScan\ExerciseData\ParcelLines.shp')<br>>>> print ds.GetLayerCount()<br>
1</div>
<div> </div>
<div>Does anybody know what I am missing?</div>
<div> </div>
<div>Regards,</div>
<div>Niels Hoffmann</div>