[GRASS-dev] pyGRASS RasterSegment error (Segment attribute has no object cseg)

Hi,

output = raster.RasterSegment(rainfall[t-1])
output.open(‘w’,‘FCELL’)
for row in range(nrows):
for col in range(ncols):
print "-> ", col, row
output[col, row] = 0.0
output.close()

returns:

→ 0 0
Traceback (most recent call last):
File “/home/user/idwt.py”, line 93, in
output[col, row] = 0.0
File “/usr/local/grass-7.0.svn/etc/python/grass/pygrass/raster/init.py”, line 277, in setitem
return self.put(x, y, row)
File “/usr/local/grass-7.0.svn/etc/python/grass/pygrass/errors.py”, line 42, in wrapper
return method(self, *args, **kargs)
File “/usr/local/grass-7.0.svn/etc/python/grass/pygrass/raster/init.py”, line 372, in put
libseg.segment_put(ctypes.byref(self.segment.cseg),
AttributeError: ‘Segment’ object has no attribute ‘cseg’

Thanks,
Yann

Hi Yann,

thank you for testing!

On Mon, Sep 16, 2013 at 11:19 AM, Yann Chemin <ychemin@gmail.com> wrote:

output = raster.RasterSegment(rainfall[t-1])
output.open('w','FCELL')
for row in range(nrows):
    for col in range(ncols):
        print "-> ", col, row
        output[col, row] = 0.0
output.close()

ok, now should be fix (r57700).

{{{

from grass.pygrass.raster import RasterSegment
yann = RasterSegment('yanntest')
yann.open('w', 'FCELL')
yann[0, 0] = 100.
yann[0, 0]

100.0
}}}

Thanks Pietro !

···

On 16 September 2013 16:59, Pietro <peter.zamb@gmail.com> wrote:

Hi Yann,

thank you for testing!

On Mon, Sep 16, 2013 at 11:19 AM, Yann Chemin <ychemin@gmail.com> wrote:

output = raster.RasterSegment(rainfall[t-1])
output.open(‘w’,‘FCELL’)
for row in range(nrows):
for col in range(ncols):
print "-> ", col, row
output[col, row] = 0.0
output.close()

ok, now should be fix (r57700).

{{{

from grass.pygrass.raster import RasterSegment
yann = RasterSegment(‘yanntest’)
yann.open(‘w’, ‘FCELL’)
yann[0, 0] = 100.
yann[0, 0]
100.0
}}}