Hi, On Aug 5, 9:32 pm, Nobody <nob...@nowhere.com> wrote: > errtype = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_int)) > errfunc = errtype(print_error) > G_set_error_routine(errfunc)
the problem occurs when restype is not None, but c_int. E.g. if hasattr(_libs['grass_gis'], 'G_set_error_routine'): G_set_error_routine = _libs['grass_gis'].G_set_error_routine G_set_error_routine.restype = c_int G_set_error_routine.argtypes = [CFUNCTYPE(UNCHECKED(c_int), String, c_int)] errtype = CFUNCTYPE(UNCHECKED(c_int), String, c_int) errfunc = errtype(print_error) or errtype = CFUNCTYPE(c_int, String, c_int) errfunc = errtype(print_error) ends up with error G_set_error_routine(errfunc) TypeError: in method 'G_set_error_routine', argument 1 of type 'int (*) (char const *,int)' The first argument of CFUNCTYPE defines result type (restype), AFAIU that should work. Thanks in advance again, Martin -- http://mail.python.org/mailman/listinfo/python-list