>> 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.
Sorry for the late reply, I fired off my original reply without testing it actually worked. It seems this functionality is no longer available (maybe with the change to the new style bindings?) or maybe it never worked in the first place. My original reply was based on a post from Frank on gdal-dev _quite_ a few years ago - http://lists.osgeo.org/pipermail/gdal-dev/2003-March/000323.html -- View this message in context: http://osgeo-org.1560.n6.nabble.com/gdal-dev-Error-handlers-in-Python-bindings-tp4987591p4991515.html Sent from the GDAL - Dev mailing list archive at Nabble.com. _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
