[GRASS-dev] [GRASS-SVN] r63227 - in grass/trunk/scripts: d.correlate d.out.file d.rast.leg d.redraw d.shadedmap d.to.rast d.vect.thematic d.what.rast d.what.vect

Markus Neteler neteler at osgeo.org
Mon Dec 1 09:00:49 PST 2014


On Mon, Dec 1, 2014 at 5:45 PM, Glynn Clements <glynn at gclements.plus.com> wrote:
> Vaclav Petras wrote:
>
>> > +    env = grass.gisenv()
>> > +    mon = env.get('MONITOR', None)
>> > +    if not mon:
>> > +        grass.fatal(_("No graphics device selected. Use d.mon to select
>> > graphics device."))
>> >
>>
>> Is this correct?
>
> Not even remotely.

ok, sorry for the mess. See below for the reason of this attempt:

> I've removed the MONITOR checks from scripts in
> r63315 (except for the ones which are wxGUI commands pretending to be
> display commands; we still need to decide on a suitable prefix for
> those).

ok.

The issue is this:

GRASS 7.1.svn (nc_spm_08_grass7):~ > g.region rast=lsat7_2002_30
GRASS 7.1.svn (nc_spm_08_grass7):~ > d.correlate map=lsat7_2002_30,lsat7_2002_40
ERROR: No graphics device selected. Use d.mon to select graphics device.
Traceback (most recent call last):
  File "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/scripts/d.correlate",
line 104, in <module>
    main()
  File "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/scripts/d.correlate",
line 46, in main
    grass.write_command('d.text', color = 'black', size = 4, line = 1,
stdin = "CORRELATION")
  File "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py",
line 483, in write_command
    return handle_errors(returncode, returncode, args, kwargs)
  File "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py",
line 308, in handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['d.text',
'color=black', 'line=1', 'stdin=CORRELATION', 'size=4'] ended with
error
Process ended with non-zero return code 1. See errors in the (error) output.


... looks rather ugly.
The same happens with several other d.* scripts. That's why I
attempted to catch this error. Please suggest how to do it right.

Markus


More information about the grass-dev mailing list