[GRASS-user] Re: [GRASS-dev] Grass Python question: do not print warnings

Glynn Clements glynn at gclements.plus.com
Thu Mar 17 23:33:03 EDT 2011


Franz Schiller wrote:

> I pretend to apply your suggestion to
> proj_image = grass.read_command('g.proj', flags = 'jf', georef = src_file)
> to this.
> If I get a piece of text in proj_image  (like the geoprojection information
> of the src_file, will the stderr=nulldev eliminate the output of this
> function?

"g.proj -jf ..." writes the projection information to stdout.
grass.read_command() captures data written to the program's stdout and
returns it as a string.

Passing stderr=... will redirect messages and warnings which would
otherwise have gone to e.g. the terminal. It won't affect the passing
of the projection information to the Python script.

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


More information about the grass-user mailing list