[Gdal-dev] Opening PostGIS databases with Python & OGR

Sean Fulton seanasy at gmail.com
Thu Jul 26 17:00:20 EDT 2007


I have a PostGIS database without any layers in it. If I try to connect 
the database with Python it fails.

>>> db = ogr.Open('PG:dbname=testgeo')
>>> db is None
True

However, if the database already has an existing layer (e.g. added with 
ogr2ogr) using ogr.Open() from Python works.  Can I get ogr.Open() to 
give an error message? Is there a  CPLGetLastErrorMsg()  equivalent in 
the Python API?

Thanks,

	Sean





More information about the Gdal-dev mailing list