[GRASS-user] Using grass.run_commmand

Luisa Peña luisapena1979 at gmail.com
Fri May 20 11:32:51 EDT 2011


Hi
Just one question:
is there any difference, when it comes to processing, between run_command
and read_command?
and from read_command  can I retrieve the error also?
THanks

2011/5/19 Glynn Clements <glynn at gclements.plus.com>

>
> Luisa Peña wrote:
>
> > I'm using grass.run_command and I have one question: besides setting
> flags,
> > parameters can I also get error and output from that function like
> > p=grass.run_command("r.out.xyz", parameters=X, flags="f...",
> stdout=output,
> > stderr=error)
>
> Use read_command or pipe_command.
>
> read_command returns the command's output (stdout) as a string.
>
> pipe_command returns the Popen object; read from its .stdout member.
> Call the .wait() method when you're done with it. For details of Popen
> objects, see:
>
> http://docs.python.org/library/subprocess.html#popen-objects
>
> The most general function is start_command, upon which all of the
> *_command functions (except for exec_command) are built. Again, this
> function returns the Popen object.
>
> Refer to the source code ($GISBASE/etc/python/grass/script/core.py)
> for more details. Most of those functions are only a few lines long.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110520/2b41e9d2/attachment.html


More information about the grass-user mailing list