[GRASS-dev] obtain the progress percentage of a command run from
python
G. Allegri
giohappy at gmail.com
Thu Dec 1 09:25:35 EST 2011
Thanks very much! ;)
giovanni
2011/12/1 Markus Neteler <neteler at osgeo.org>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20111201/d6135b27/attachment.html
More information about the grass-dev
mailing list