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

Hi MArtin

It worked
I just have one final question:
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?

Thanks
Franz

Hi,

2011/3/17 Franz Schiller <franzschiller1975@gmail.com>:

It worked
I just have one final question:
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?

I don't fully understand your question, anyway it will discard all
messages printed by `g.proj` to stderr.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

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@gclements.plus.com>