[gdal-dev] [gdal Python] Exceptions not reset correctly if
gdal.UseExceptions() is used
Luca Fasano
lucafasano at interfree.it
Thu Jun 18 04:09:27 EDT 2009
Hi all,
I suspect there is a bug in gdal.UseExceptions() in python binding.
I noticed that if a RuntimeError has been generated, following gdal
instructions *raise the same exception*.
It seems that a gdal.ErrorReset() is necessary to reset it.
An example with ipython:
In [2]: from osgeo import gdal
In [3]: gdal.UseExceptions()
In [4]: dataset = gdal.Open('./filename.wrongformat')
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call
last)
/home/fasano/Desktop/test/<ipython console> in <module>()
RuntimeError: `./filename.wrongformat' not recognised as a supported
file format.
In [5]: gdal.GetCacheMax()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call
last)
/home/fasano/Desktop/test/<ipython console> in <module>()
RuntimeError: `./filename.wrongformat' not recognised as a supported
file format.
In [6]: gdal.ErrorReset()
In [7]: gdal.GetCacheMax()
Out[7]: 41943040
(My gdal version is 1.5.4)
More information about the gdal-dev
mailing list