Luca,

(This behaviour is identical in trunk too)

we could probably reset the error state after issuing the exception, but that 
would prevent code from getting the error message if they call 
gdal.GetLastErrorMsg() afterwards. But I don't think this would be a problem.
We should probably also call ErrorReset() in gdal.UseExceptions() so that 
previous errors don't cause unexpected exceptions to be thrown.

Howard ?

Le Thursday 18 June 2009 10:09:27 Luca Fasano, vous avez écrit :
> 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)
>
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to