[GRASS-user] i.spectral.py in WinGrass

Glynn Clements glynn at gclements.plus.com
Wed Dec 8 06:34:11 EST 2010

Daniel Victoria wrote:

> You are right Glynn, I just checked i.spectral.py and it has the
> d.linegraph feature but, i.spectral is greyed out in wxpython gui

That's a bug in the wxGUI. All scripts will be greyed out on Windows.

[For grass-dev]

The bug is in GetGRASSCmds in globalvar.py. It checks whether the last
4 characters of the filename are '.exe' or '.py'. As '.py' is only 3
characters, it will never match. The code should be using

> and,
> when I try to run it from the command line (using Msys wingrass7svn),
> if I input a raster group I get the error:

The output format for "i.group -l ..." was changed in r34815, which
breaks the script. I'll change it to use "i.group -g ..." instead.

> If I try to run it using the raster options I don't get any errors but
> nothing is displayed to the screen.

That's to be expected. 7.0 doesn't support display monitors. All d.*
commands generate an image in the file specified by $GRASS_PNGFILE, or
map.png if that variable isn't set. Check whether a file named map.png
was created.

You can have the output displayed within the wx GUI by adding a
command layer for the i.spectral command.

Alternatively, you can try the wxpyimgview script (not tested on
Windows, assumes that you're using bash as the shell):

	export GRASS_PNGFILE=map.bmp
	wxpyimgview map.bmp &

> Running from the command console in wxgui I get:

> ImportError: No module named collections

> It looks as though I don't have the collections module?

That seems to be a common issue with Python on Windows. FWIW, the
stock Python 2.6.4 installer for Windows does include this module.

But fixing that probably won't let you run i.spectral from the GUI's
command prompt. The last time I checked, "display" commands were
handled by checking that the program name begins with "d.", so it
won't work with i.spectral. Renaming the installed script to
d.spectral.py may work (once the bug mentioned above is fixed).

But ideally, the command prompt should set GRASS_PNGFILE to a
temporary filename then check whether the file was created. That will
handle all display commands, regardless of how they're named.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list