[Gfoss] [GRASS 7] Grass 7 e python script

Markus Neteler neteler a osgeo.org
Mar 13 Ott 2009 09:19:26 CEST


2009/10/11 junkhead a funbox.it <maurizio.melani a gislab.it>:
> Ciao ho installato da snv i nuovi sorgenti,
> anche io ho il medesimo errore "TypeError: 'int' object is
> unsubscriptable"

Viene discussiono nella grass-dev mailing list, ecco
una risposta spero utile:

On Mon, Oct 12, 2009 at 9:34 PM, Glynn Clements
<glynn a gclements.plus.com> wrote:
> Try:
>        import array
>        inrast = array.array('i')
>        inrast.extend([0] * gis.G_window_cols())
> This is a good example of one of SWIG's main limitations. The only
> thing it knows about Rast_allocate_buf() is that it returns a void*;
> there's no way that it can generate a usable Python object from that
> (it doesn't know the actual element type or the number of elements).
> In general, it's easier to create objects in Python and pass them to C
> than the other way around.
> The only real solution is to code wrappers by hand; a C prototype
> simply doesn't contain enough information to create a wrapper in
> anything beyond the simplest cases.
> --
> Glynn Clements <glynn a gclements.plus.com>
> _______________________________________________
> grass-dev mailing list
> grass-dev a lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


Maggiori informazioni sulla lista Gfoss