Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3692 closed defect (fixed)

The python gcore message() function does not work in 7.4.2

Reported by: micha Owned by: grass-dev@…
Priority: critical Milestone: 7.4.3
Component: Python Version: 7.4.2
Keywords: message, python Cc:
CPU: Unspecified Platform: Unspecified

Description

Printing messages (warning, error, info) in a python script using GRASS 7.4.2 gives 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

Change History (12)

comment:1 by NikosA, 6 years ago

Same here for GRASS GIS 7.4.3svn (r73647). Works for trunk, GRASS GIS 7.7.svn (r73645M).

comment:2 by martinl, 6 years ago

Component: DefaultPython

comment:3 by martinl, 6 years ago

Right, only G74 seems to be affected. Works also in G76.

comment:4 by martinl, 6 years ago

Comparing G74 and G76, this could play a role since messages are printed to stderr.

-_capture_stderr = True  # capture stderr of subprocesses if possible
+_capture_stderr = False  # capture stderr of subprocesses if possible

comment:5 by martinl, 6 years ago

Right, after changing

_capture_stderr = True

to

_capture_stderr = False

message is printed out.

Last edited 6 years ago by martinl (previous) (diff)

comment:6 by martinl, 6 years ago

Seems to be introduced in r73240

comment:7 by martinl, 6 years ago

Priority: normalcritical

comment:8 by martinl, 6 years ago

Apparently r73269 hasn't been backported to G74 branch...

comment:9 by martinl, 6 years ago

Resolution: fixed
Status: newclosed

In 73651:

libpython: revert r73238, fixes #3692

comment:10 by neteler, 6 years ago

I guess this warrants a new release? :(

comment:11 by martinl, 6 years ago

Right, what about releasing GRASS 7.4.3 soon (within weeks) with just one RC?

in reply to:  11 comment:12 by mmetz, 6 years ago

Replying to martinl:

Right, what about releasing GRASS 7.4.3 soon (within weeks) with just one RC?

That was partially my fault, even though r73240 was authored by neteler, sorry for the trouble! It was an attempt to capture standard error from python multiprocessing, but we found another solution.

+1 for releasing GRASS 7.4.3 soon, also because of an important bug fix in r.external.

Note: See TracTickets for help on using tickets.