EnglishFrenchSpanish

Ad


OnWorks favicon

g.messagegrass - Online in the Cloud

Run g.messagegrass in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command g.messagegrass that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


g.message - Prints a message, warning, progress info, or fatal error in the GRASS way.
This module should be used in scripts for messages served to user.

KEYWORDS


general, support, scripts

SYNOPSIS


g.message
g.message --help
g.message [-wedpiv] message=string [debug=integer] [--help] [--verbose] [--quiet]
[--ui]

Flags:
-w
Print message as warning

-e
Print message as fatal error

-d
Print message as debug message

-p
Print message as progress info

-i
Print message in all modes except of quiet mode
Message is printed on GRASS_VERBOSE>=1

-v
Print message only in verbose mode
Message is printed only on GRASS_VERBOSE>=3

--help
Print usage summary

--verbose
Verbose module output

--quiet
Quiet module output

--ui
Force launching GUI dialog

Parameters:
message=string [required]
Text of the message to be printed
Message is printed on GRASS_VERBOSE>=2

debug=integer
Level to use for debug messages
Options: 0-5
Default: 1

DESCRIPTION


This program is to be used in Shell/Perl/Python scripts, so the author does not need to
use the echo program. The advantage of g.message is that it formats messages just like
other GRASS modules do and that its functionality is influenced by the GRASS_VERBOSE and
GRASS_MESSAGE_FORMAT environment variables.

The program can be used for standard informative messages as well as warnings (-w flag)
and fatal errors (-e flag). For debugging purposes, the -d flag will cause g.message to
print a debugging message at the given level.

NOTES


Messages containing "=" must use the full message= syntax so the parser doesn’t get
confused.

If you want a long message (multi-line) to be dealt with as a single paragraph, use a
single call to g.message with text split in the script using the backslash as the last
character. (In shell scripts don’t close the "quote")

A blank line may be obtained with
g.message message=""

Redundant whitespace will be stripped away.

It’s advisable to single quote the messages that are to be printed literally. It prevents
a number of characters (most notably, space and the dollar sign ’$’) from being treated
specifically by the shell.

When it is necessary to include, for example, a variable’s value as part of the message,
the double quotes may be used, which do not deprive the dollar sign of its special
variable-expansion powers.

While it is known that the interactive Bash instances may treat the exclamation mark ’!’
character specifically (making single quoting of it necessary), it shouldn’t be the case
for the non-interactive instances of Bash. Nonetheless, to avoid context-based confusion
later on you are enouraged to single-quote messages that do not require $VARIABLE
expansion.

Usage in Python scripts
GRASS Python Scripting Library defines special wrappers for g.message.

· debug() for g.message -d

· error() for g.message -e

· fatal() for g.message -e + exit()

· info() for g.message -i

· message() for g.message

· verbose() for g.message -v

· warning() for g.message -w

Note: The Python shell in the wxGUI can be used for entering the following sample code:

import grass.script as gcore
gcore.warning("This is a warning")
is identical with
g.message -w message="This is a warning"

VERBOSITY LEVELS
Controlled by the "GRASS_VERBOSE" environment variable. Typically this is set using the
--quiet or --verbose command line options.

· 0 - only errors and warnings are printed

· 1 - progress messages are printed

· 2 - all module messages are printed

· 3 - additional verbose messages are printed

DEBUG LEVELS
Controlled by the "DEBUG" GRASS gisenv variable (set with g.gisenv).
Recommended levels:

· 1 - message is printed once or few times per module

· 3 - each row (raster) or line (vector)

· 5 - each cell (raster) or point (vector)

Use g.messagegrass online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 2
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 3
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 4
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 5
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • 6
    Shadowsocks
    Shadowsocks
    A fast tunnel proxy that helps you
    bypass firewalls This is an application
    that can also be fetched from
    https://sourceforge.net/projects/shadowsocksgui/.
    It ha...
    Download Shadowsocks
  • More »

Linux commands

Ad