Woks!. Thank you. Fernando.<br><br clear="all">Ing. Fernando Pacheco M.S.L.<br><br>Ingesur srl<br>Dirección: Requena 1062 ap.302, Montevideo, Uruguay.<br>Teléfonos: (+598 2) 408 90 48, (+598 9) 962 79 32<br>Web: <a href="http://ingesur.com.uy/">http://ingesur.com.uy/</a><br>
<br><br><div class="gmail_quote">On Tue, Jun 15, 2010 at 1:56 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
Fernando Pacheco wrote:<br>
<br>
> I'm trying to access a grass vector map with python (2.6). I'm using the svn<br>
> version (revision 42 565) but keep getting "Segmentation fault" when trying<br>
> to open the file with Vect_open_old (map, input, mpaset). The code I'm using<br>
> can be found here: <a href="http://osgeo.pastebin.com/VLGunxyq" target="_blank">http://osgeo.pastebin.com/VLGunxyq</a><br>
> Can you please tell me I'm doing wrong (the same code works well with python<br>
> libraries generated with SWIG)?.<br>
<br>
</div>There are two problems, one in your code, one in the ctypes wrappers.<br>
<br>
First, Vect_open_old needs a pointer to a a Map_info structure, not<br>
the structure itself, so you need to use byref(), e.g.:<br>
<br>
from ctypes import *<br>
<br>
...<br>
<br>
vector.Vect_open_old(byref(map), input, mapset)<br>
<br>
Second, if LFS is enabled, any files which use the vector structures<br>
are compiled with -D_FILE_OFFSET_BITS=64. This wasn't being passed to<br>
the preprocessor when the ctypes wrappers were generated, resulting in<br>
incorrect wrappers being generated for various structures, including<br>
the Map_info structure. This should be fixed by r42566.<br>
<font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote></div><br>