[GRASS-user] g.message in python not working

Moritz Lennert mlennert at club.worldonline.be
Tue Nov 6 04:17:15 PST 2018


On 06/11/18 12:36, Micha Silver wrote:
> Is there any change in the way g.message works under python between 
> GRASS 7.4.0 and 7.4.2? I am not getting any message output. (python 
> "print" and "cat" statements work as expected). The script printed 
> messages fine in 7.4.0.
> 
> 
> I see the usual result at a shell prompt:
> 
> 
> GRASS 7.4.2 (ITM):~ > g.message "Hello"
> 
> Hello
> GRASS 7.4.2 (ITM):~ > g.message -w "Hello"
> WARNING: Hello
> 
> 
> However in a python script no output:
> 
> 
> GRASS 7.4.2 (ITM):~ > ipython2
> 
> Python 2.7.12 (default, Dec  4 2017, 14:50:18)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 5.1.0 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]: import grass.script as gs
> In [2]: gs.message("Hello")
> In [3]: gs.warning("Hello")
> In [4]: print("Hello")
> Hello

I can confirm this behaviour in the 7.4.2 Debian testing package. Please 
post a ticket. It works as expected in 7.6 and trunk.

Moritz


More information about the grass-user mailing list