[gdal-dev] pass gdal dataset as an argument from Python to C

Shawn Gong SGONG at mdacorporation.com
Thu Nov 23 12:25:08 PST 2017


Hi list,



Has anyone done this before?

I try to pass a gdal dataset as an argument from Python to C.



in my C code, I have

PyObject* py_my_func(PyObject *self, PyObject *args)
{

    PyObject *poDataset;



   if(!PyArg_ParseTuple(args, "Odd", &poDataset, &a1, &a2))
  {
    return NULL;
  }



  my_func(poDataset, a1, a2);
}



void my_func(GDALDatasetH hDataset, double a1, double a2)

{

}



Python crashed and hDataset was NULL

Is it possible to do or I did something wrong?



BTW, I have passed either a filename or a gdal array as an argument from Python to C, with success.


Thanks,
Shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171123/6632109a/attachment.html>


More information about the gdal-dev mailing list