[gdal-dev] Error handlers in Python bindings

Fabian Schindler fabian.schindler at eox.at
Thu Jul 12 01:24:21 PDT 2012


Thanks for the answer, but unfortunately this does not work on my machine:

>>>  from osgeo import gdal

>>>  def f(err_class, err_code, msg):

...     print err_class, err_code, msg

...

>>>  gdal.PushErrorHandler(f)

Traceback (most recent call last):

   File "<stdin>", line 1, in<module>

   File "/usr/lib/python2.6/dist-packages/osgeo/gdal.py", line 312, in PushErrorHandler

     return _gdal.PushErrorHandler(*args)

NotImplementedError: Wrong number of arguments for overloaded function 'PushErrorHandler'.

   Possible C/C++ prototypes are:

     PushErrorHandler(char const *)

     CPLPushErrorHandler(CPLErrorHandler)


Maybe I need a newer GDAL version?


On 07/12/2012 02:42 AM, lpinner wrote:
> 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)
>
> --
> 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



More information about the gdal-dev mailing list