[GRASS-dev] Using the pygrass "Mapset.glist" method and a dictionary

Nikos Alexandris nik at nikosalexandris.net
Thu May 23 12:50:10 PDT 2013


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?

Thank you for any hints, Nikos


More information about the grass-dev mailing list