Re: [GRASS-dev] grass.info versus print

2016-04-21 Thread Glynn Clements
Vaclav Petras wrote: > Perhaps I was not completely clear before. I agree with Glynn. > grass.script.message() etc. for messages. print()/sys.stdout for text > output (e.g. tables). In short: g.message for "messages", print or sys.stdout.write() for "data". The reason why Unix has stdout and

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Vaclav Petras
On Thu, Apr 14, 2016 at 9:55 AM, Paulo van Breugel wrote: > I would have to go through the individual examples but sometimes it might > be be clear what is a message to inform user about something and what is a > text output of the module. A rule of thumb can be that

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Paulo van Breugel
On 14-04-16 16:20, Vaclav Petras wrote: On Thu, Apr 14, 2016 at 9:55 AM, Paulo van Breugel > wrote: I would have to go through the individual examples but sometimes it might be be clear what is a message to inform user about

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Paulo van Breugel
On 14-04-16 14:27, Vaclav Petras wrote: On Thu, Apr 14, 2016 at 7:33 AM, Paulo van Breugel > wrote: On Thu, Apr 14, 2016 at 1:04 PM, Glynn Clements > wrote:

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Vaclav Petras
On Thu, Apr 14, 2016 at 7:33 AM, Paulo van Breugel wrote: > On Thu, Apr 14, 2016 at 1:04 PM, Glynn Clements > wrote: > >> >> In general, scripts should use the g.message wrappers rather than >> Python's "print" statement or os.write(), as that

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Paulo van Breugel
On Thu, Apr 14, 2016 at 1:04 PM, Glynn Clements wrote: > > Vaclav Petras wrote: > > > sys.stdout/print is the way. grass.script.info and others are for > messages, > > not output, and they go to stderr which might cause mixing of order with > > stdout in GUI and I

Re: [GRASS-dev] grass.info versus print

2016-04-14 Thread Glynn Clements
Vaclav Petras wrote: > sys.stdout/print is the way. grass.script.info and others are for messages, > not output, and they go to stderr which might cause mixing of order with > stdout in GUI and I unfortunately don't know how to avoid it. grass.script.info() executes "g.message -i", which calls

Re: [GRASS-dev] grass.info versus print

2016-04-11 Thread Paulo van Breugel
Hi Vaclav, On 11-04-16 17:18, Vaclav Petras wrote: Hi, Paulo! On Mon, Apr 11, 2016 at 10:04 AM, Paulo van Breugel > wrote: I want to provide the output formatted in three columns. I can use nlength = 20 RES = [MAPy, vif,

Re: [GRASS-dev] grass.info versus print

2016-04-11 Thread Vaclav Petras
Hi, Paulo! On Mon, Apr 11, 2016 at 10:04 AM, Paulo van Breugel wrote: > I want to provide the output formatted in three columns. I can use > > nlength = 20 > RES = [MAPy, vif, sqrtvif] > print '{0[0]:{1}s} {0[1]:8.2f} {0[2]:8.2f}'.format(RES, nlength) > > This prints

[GRASS-dev] grass.info versus print

2016-04-11 Thread Paulo van Breugel
Hi, I am working on a script in which I want to provide the output formatted in three columns. I can use nlength = 20 RES = [MAPy, vif, sqrtvif] print '{0[0]:{1}s} {0[1]:8.2f} {0[2]:8.2f}'.format(RES, nlength) This prints nicely on the command line. However, on the command output tab of the GUI,