On 23/05/13 21:50, Nikos Alexandris wrote:
Hi list.

In a Python script, I use the following pygrass method to retrieve a list of
raster maps:

        from grass.pygrass.gis import Mapset
        ..
        landsat_imagery = dict()
        ..
        landsat_imagery['Spectral Bands'] = Mapset().glist('rast', pattern =
'B[123457]')

However, whenever the result is empty, i.e. there are no B1, B2 and so on
named raster maps, running the script fails with the error:


        landsat_imagery['Spectral Bands'] = Mapset().glist('rast', pattern =
'B[123457]')
        TypeError: 'str' object is not callable


Running the instructions step-wise, from within ipython, doesn't appear to be
problematic.  What am I missing in this case?

I can't reproduce this:

>>> landsat_imagery = dict()
>>> landsat_imagery
{}
>>> Mapset().glist('rast', pattern = 'B[123457]')
[]
>>> landsat_imagery['Spectral Bands'] = Mapset().glist('rast', pattern = 'B[123457]')
>>> landsat_imagery
{'Spectral Bands': []}

So even with an empty result of the glist call, I don't get an error message.

Moritz
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to