<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 14, 2016 at 9:55 AM, Paulo van Breugel <span dir="ltr"><<a href="mailto:p.vanbreugel@gmail.com" target="_blank">p.vanbreugel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>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 modules which output
              maps, (usually) don't do text output, so they shouldn't
              use print().<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    In this case (r.vif) the output is not a map, but a list of values,
    i.e., text output (see below). Based on the guidelines, I would
    assume I should use print()? <br></blockquote><div><br></div><div>Then print() is the right thing. I would recommend finding a similar module and see its behavior. For example, r.univar will give you human readable report and also parseable output (in this case by grass.script.parse_command()). Both are written to standard output (the g.message wrappers use standard error output).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    <br>
    <pre>All variables</pre>
    <pre>----------------------------------------</pre>
    <pre>variable                           vif      sqrtvif</pre>
    <pre>2000_01_precip@climate_1970_2012       2.30     1.52</pre>
    <pre>2000_03_tempmean@climate_1970_2012    24.95     5.00</pre>
    <pre>2000_11_precip@climate_1970_2012       3.54     1.88</pre>
    <pre>2001_02_precip@climate_1970_2012       4.55     2.13</pre>
    <pre>2001_04_tempmean@climate_1970_2012    25.01     5.00</pre>
    <pre>Variable '2001_04_tempmean@climate_1970_2012' removed</pre>
    <pre>----------------------------------------</pre>
    <pre>variable                           vif      sqrtvif</pre>
    <pre>2000_01_precip@climate_1970_2012       2.30     1.52</pre>
    <pre>2000_03_tempmean@climate_1970_2012     2.19     1.48</pre>
    <pre>2000_11_precip@climate_1970_2012       3.48     1.87</pre>
    <pre>2001_02_precip@climate_1970_2012       4.54     2.13</pre>
    <pre>Final selected variables are: 2000_01_precip, 2000_03_tempmean, 2000_11_precip, 2001_02_precip</pre>
    
    <pre style="margin-bottom:0.5cm"><tt>with as maximum VIF: 5.69787583189</tt></pre><span class="">
    
    
    <br></span></blockquote><div><br></div><div>This definitively looks like something from r.report or <a href="http://r.info">r.info</a>.<br>
               <br>
            </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div>Perhaps the most important thing is that one should
                avoid mixing the two, which is something that maybe
                could go somewhere in the wiki?<br>
              </div>
            </blockquote>
            <div><br>
              Feel free to extent either wiki or guidelines if you think
              it is not clear enough.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    I wouldn't mind doing so, but I probably should understand better
    myself what exactly the issue is with using both print() and
    <a href="http://grass.info" target="_blank">grass.info</a>() in one script. Based on what I read in the guidelines,
    I am not clear whether using both is against the guidelines as such,</blockquote><div><br>You can use both in one script. The difference is what you use them for. For example, a lot of modules will tell which map was created (this is done through g.message or its C equivalents), while g.region -p will use standard output. Some cases are unclear, for example v.in.lidar uses standard output (fprintf(stdout,...)) to tell how many points imported. G_message() might be more appropriate here because it is an message to the user while the output is the vector map. If G_message() would be used, this output could be silenced by --quiet.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">but technically it seems it can cause problems as you explained (and
    I experienced). <br><span class="">
    </span></blockquote></div><br></div><div class="gmail_extra">They are mostly related to syncing of stdout and strerr streams which is more challenging for the GUI (and may need some fixing there).<br></div></div>