[GRASS-dev] obtain the progress percentage of a command run from
python
Markus Neteler
neteler at osgeo.org
Thu Dec 1 04:14:07 EST 2011
On Thu, Dec 1, 2011 at 7:57 AM, Glynn Clements <glynn at gclements.plus.com> wrote:
...
> If you want to parse the output, set GRASS_MESSAGE_FORMAT=gui in the
> environment when running the command and read from the command's
> stderr; e.g.
>
> import grass.script as grass
> env = os.environ.copy()
> env['GRASS_MESSAGE_FORMAT'] = 'gui'
> p = grass.start_command(..., stderr = grass.PIPE, env = env)
> # read from p.stderr
> p.wait()
>
> If you need to capture both stdout and stderr, you need to use
> threads, select, or non-blocking I/O to consume data from both streams
> as it is generated in order to avoid deadlock.
Thanks, added to
http://grass.osgeo.org/wiki/GRASS_and_Python#Percentage_output_for_progress_of_computation
Markus
More information about the grass-dev
mailing list