[gdal-dev] Error handlers in Python bindings

Fabian Schindler fabian.schindler at eox.at
Thu Jul 12 02:14:00 PDT 2012


Thanks Even,

I feared that this was the case. But the `UseException` function looks 
promising.

Regards,
Fabian


On 07/12/2012 10:59 AM, Even Rouault wrote:
> Selon lpinner<Luke.Pinner at environment.gov.au>:
>
>> The python function needs to accept three arguments, error class, error code
>> and error message.
>>
>> i.e.
>> from osgeo import gdal
>> def f(err_class, err_code, msg):
>>      print err_class, err_code, msg
>>
>> gdal.PushErrorHandler(f)
> Reviewing the Python bindings code, I see no evidence that Python error handlers
> are possible. An option is to use gdal.UseExceptions() which will cause a Python
> exception to be thrown after a GDAL call has emitted an error.
>
>> --
>> View this message in context:
>>
> http://osgeo-org.1560.n6.nabble.com/gdal-dev-Error-handlers-in-Python-bindings-tp4987591p4987809.html
>> Sent from the GDAL - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list