Markus Neteler wrote:

> I have made some necessary updates in
> grass70/swig/python/examples/rasteraccess.py
> but seem to have missed one:
> 
> GRASS 7.0.svn (spearfish60):~ > python
> grass70/swig/python/examples/rasteraccess.py
> Raster Map Name? elevation.10m
> 0
> Traceback (most recent call last):
>   File "grass70/swig/python/examples/rasteraccess.py", line 47, in <module>
>     print rown, myrow[0:10]
> TypeError: 'int' object is unsubscriptable
> 
> ?

Rast_get_row() returns an integer; if you want to print the first 10
values, use inrast[0:10].

A much older version of the SWIG interface assumed that a non-const
int/float/double pointer argument referred to a row buffer which was
filled in by the function, and would automatically allocate the buffer
and return it as the result. This failed for other cases, so the
feature was removed.

-- 
Glynn Clements <[email protected]>
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to