[GRASS-dev] python raster_history function broken?

Hi everybody,

The raster_history function on my computer is not working.

In [5]: raster.raster_history('elevation')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-5-2ee82b501872> in <module>()
----> 1 raster.raster_history('elevation')

/home/lucadelu/compilati/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/raster.pyc
in raster_history(map)
     40 current_mapset = gisenv()['MAPSET']
     41 if find_file(name=map)['mapset'] == current_mapset:
---> 42 run_command('r.support', map=map, history=os.environ['CMDLINE'])
     43 return True
     44

/usr/lib/python2.7/UserDict.pyc in __getitem__(self, key)
     21 if hasattr(self.__class__, "__missing__"):
     22 return self.__class__.__missing__(self, key)
---> 23 raise KeyError(key)
     24 def __setitem__(self, key, item): self.data[key] = item
     25 def __delitem__(self, key): del self.data[key]

In [8]: 'CMDLINE' in os.environ.keys()
Out[8]: False

What should CMDLINE environment variable do?

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

Luca Delucchi wrote:

The raster_history function on my computer is not working.

In [8]: 'CMDLINE' in os.environ.keys()
Out[8]: False

What should CMDLINE environment variable do?

It contains an approximation to the command line used to run the
script, as a string It's set by grass.script.parser() (in
lib/python/script/core.py):

    cmdline = [basename(sys.argv[0])]
    cmdline += ['"' + arg + '"' for arg in sys.argv[1:]]
    os.environ['CMDLINE'] = ' '.join(cmdline)

--
Glynn Clements <glynn@gclements.plus.com>