[GRASS-user] v.to.rast in a python loop, error

Glynn Clements glynn at gclements.plus.com
Mon Feb 13 17:47:18 EST 2012


Johannes Radinger wrote:

> Looks weird as "2nd g.list over" is printed after the ERROR, resp.
> the ERROR is produced by v.to.rast before the print statement is processed...

This is almost certainly an artifact of the GUI.

Python's "print" statement writes to stdout by default, while GRASS
error messages are written to stderr. If both the print statment and
the v.to.rast commands are executed before the GUI gets around to
reading the pipes, the order in which the output appears will depend
upon the order in which the GUI reads the pipes.

This is a common problem with "splitting" stdout and stderr, and there
isn't a solution (other than to not split them, but then the GUI can't
distinguish between stdout and stderr).

Try executing the script from a terminal. Both stdout and stderr will
refer to the terminal, so the output will appear in the order in which
the statements are executed.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list