Fernando Pacheco wrote: > I'm trying to access a grass vector map with python (2.6). I'm using the svn > version (revision 42 565) but keep getting "Segmentation fault" when trying > to open the file with Vect_open_old (map, input, mpaset). The code I'm using > can be found here: http://osgeo.pastebin.com/VLGunxyq > Can you please tell me I'm doing wrong (the same code works well with python > libraries generated with SWIG)?.
There are two problems, one in your code, one in the ctypes wrappers. First, Vect_open_old needs a pointer to a a Map_info structure, not the structure itself, so you need to use byref(), e.g.: from ctypes import * ... vector.Vect_open_old(byref(map), input, mapset) Second, if LFS is enabled, any files which use the vector structures are compiled with -D_FILE_OFFSET_BITS=64. This wasn't being passed to the preprocessor when the ctypes wrappers were generated, resulting in incorrect wrappers being generated for various structures, including the Map_info structure. This should be fixed by r42566. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev