[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

Vaclav Petras wenzeslaus at gmail.com
Tue Dec 2 19:11:42 PST 2014


On Tue, Dec 2, 2014 at 5:09 PM, Glynn Clements <glynn at gclements.plus.com>
wrote:

> Markus Neteler wrote:
>
> > 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):
> > ...
> > 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.
>
> I can't reproduce the problem. And I'm not even sure how d.text can
> exit with a non-zero return code without printing any error message.


I can reproduce it. Are you sure you don't have MONITOR or
GRASS_RENDER_IMMEDIATE (or any other if it matters) set? I start GRASS
session (without any special shell environment) and I get it.

The error is the beginning, r.text is printed first (that's ERROR:... I
think), then the error from the main process is printed (Traceback....).

I think the solution is try-except or calling the function(s) with with
secret `errors` parameter set to 'exit'. The later is usually not the ideal
solution but it might be appropriate for some calls in d.* scripts. The
issue is that with errors='exit' you cannot provide the user with failed
module name, so then the context of the error message might be unclear.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141202/7e69700c/attachment-0001.html>


More information about the grass-dev mailing list