[GRASS-dev] access to grass (trunk 7.0.svn ) vector map from python

Fernando Pacheco fernando.pacheco at ingesur.com.uy
Tue Jun 15 16:26:43 EDT 2010


I modified the code as you have suggested. But I encounter a new problem. If
I run a simple program from the command line like this:
http://osgeo.pastebin.com/pPqkcvk3 get the following error:
"python: malloc.c:4628: _int_malloc: Assertion `(unsigned long)(size) >=
(unsigned long)(nb)' failed."
I updated the code to the 42566 version but I still have the same problem. Any
suggestions?. I will keep trying!. Thank you. Fernando.

Ing. Fernando Pacheco M.S.L.

Ingesur srl
Dirección: Requena 1062 ap.302, Montevideo, Uruguay.
Teléfonos: (+598 2) 408 90 48, (+598 9) 962 79 32
Web: http://ingesur.com.uy/



On Tue, Jun 15, 2010 at 2:10 PM, Fernando Pacheco <
fernando.pacheco at ingesur.com.uy> wrote:

> Woks!. Thank you. Fernando.
>
>
> Ing. Fernando Pacheco M.S.L.
>
> Ingesur srl
> Dirección: Requena 1062 ap.302, Montevideo, Uruguay.
> Teléfonos: (+598 2) 408 90 48, (+598 9) 962 79 32
> Web: http://ingesur.com.uy/
>
>
> On Tue, Jun 15, 2010 at 1:56 PM, Glynn Clements <glynn at gclements.plus.com>wrote:
>
>>
>> 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 <glynn at gclements.plus.com>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20100615/3e67b46e/attachment.html


More information about the grass-dev mailing list