[GRASS-dev] grass.info versus print
Glynn Clements
glynn at gclements.plus.com
Thu Apr 14 04:04:06 PDT 2016
Vaclav Petras wrote:
> sys.stdout/print is the way. grass.script.info and others are for messages,
> not output, and they go to stderr which might cause mixing of order with
> stdout in GUI and I unfortunately don't know how to avoid it.
grass.script.info() executes "g.message -i", which calls
G_important_message(), which writes to stderr.
In general, scripts should use the g.message wrappers rather than
Python's "print" statement or os.write(), as that will honour any
configuration options (GRASS_VERBOSE, GRASS_MESSAGE_FORMAT,
--quiet/--verbose, etc).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list