[gdal-dev] Making OGR raise exceptions in Python

Matsamentet mbu at teleplan.no
Tue Jan 21 04:18:31 PST 2020


I'm developing a Python script which uses both gdal and ogr. Since
exceptions are not raised by default, I have added to my script


*raster_ds = gdal.Open('c:/nonexistant.tif')* raises an exception as
*vector_ds = ogr.Open('c:/nonexistant.shp')* on the other hand, quietly
returns nothing with no exception raised. It also tried other methods of ogr
like GetDriver, 

Is this the intended behaviour, and if so, is there another way to make ogr
raise exceptions?

I'm using GDAL 3.0.2 and Python 3.7.6


Mats Budalen

Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html

More information about the gdal-dev mailing list