[GRASS-dev] Python and delayed or missing stderr output

Markus Metz markus.metz.giswork at gmail.com
Sun Sep 9 12:47:08 PDT 2018


On Wed, Sep 5, 2018 at 10:43 AM Markus Neteler <neteler at osgeo.org> wrote:
>
> Hi,
>
> AFAIK Python buffers (i.e. effectively delays)  stderr output which is
> unhelpful in the GRASS GIS context.
>
> Searching for a solution, I found this reference: sys.stdout.flush()
> e.g.
>
https://stackoverflow.com/questions/10019456/usage-of-sys-stdout-flush-method

That should be
sys.stderr.flush()
right?

Regarding python's multiprocessing, it makes sense that stderr is
suppressed because you would not know which process process produced which
stderr (or stdout) message. There must be a method in python to redirect
stderr and stdout for each process to a unique file, otherwise it would not
be possible to find out why some process failed.

Such a method would need to be implemented in each module usings python's
multiprocessing.

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180909/dbad608e/attachment.html>


More information about the grass-dev mailing list