Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Vaclav Petras
On Sun, Sep 9, 2018 at 4:47 PM Markus Neteler wrote: > > > > That gives little too much information, so perhaps: > > > > FILE="`./bin.x86_64-pc-linux-gnu/grass77 --tmp-location XY --exec which r.mask`" > > grass --tmp-location XY --exec python -m trace --trace $FILE -r | grep `basename $FILE` > >

Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Markus Neteler
On Sun, Sep 9, 2018 at 10:13 PM Vaclav Petras wrote: > On Sun, Sep 9, 2018 at 3:37 PM Markus Metz > wrote: > > On Sun, Sep 9, 2018 at 4:46 PM Markus Neteler wrote: > > > > > > > > I'd also like to see a way to print through the parser, i.e. a > > > functionality similiar to "sh -x shellscript"

Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Vaclav Petras
On Sun, Sep 9, 2018 at 3:37 PM Markus Metz wrote: > > > > On Sun, Sep 9, 2018 at 4:46 PM Markus Neteler wrote: > > > > > I'd also like to see a way to print through the parser, i.e. a > > functionality similiar to "sh -x shellscript" which prints every step. > > Is that possible? > > In Python

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

2018-09-09 Thread Markus Metz
On Wed, Sep 5, 2018 at 10:43 AM Markus Neteler 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. >

Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Markus Metz
On Sun, Sep 9, 2018 at 4:46 PM Markus Neteler wrote: > > On Sun, Sep 9, 2018 at 4:23 PM Markus Metz > wrote: > > On Sun, Sep 9, 2018 at 3:47 PM Markus Neteler wrote: > > > > > > Hi, > > > > > > Why does G_message() print to stderr and not stdout? > > >

Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Markus Neteler
On Sun, Sep 9, 2018 at 4:23 PM Markus Metz wrote: > On Sun, Sep 9, 2018 at 3:47 PM Markus Neteler wrote: > > > > Hi, > > > > Why does G_message() print to stderr and not stdout? > > https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/error.c#L84 > > Messages, warnings and errors are not

Re: [GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Markus Metz
On Sun, Sep 9, 2018 at 3:47 PM Markus Neteler wrote: > > Hi, > > Why does G_message() print to stderr and not stdout? > https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/error.c#L84 Messages, warnings and errors are not output. Consider g.region -g, r.info -g, r.univar -g or any module

[GRASS-dev] Using grass.message in Python: Why does G_message() print to stderr and not stdout?

2018-09-09 Thread Markus Neteler
Hi, Why does G_message() print to stderr and not stdout? https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/error.c#L84 This is a big problem when working with grass.run_command() and friends since Python tends to buffer error messages (or occasionally eats them). I have no reference why