rsbivand / rgrass

Interpreted interface between the GRASS geographical information system and R
https://rsbivand.github.io/rgrass/
24 stars 8 forks source link

warning message - running command 'g.proj.exe -w' had status 884 #33

Open obrl-soil opened 2 years ago

obrl-soil commented 2 years ago

Setup:

library(rgrass7)

initGRASS(gisBase  = file.path('C:', 'OSGeo4W', 'apps', 'grass', 'grass78'),
          gisDbase = file.path(getwd(), 'data_spatial'),  location = 'grass_data', 
          mapset   = "PERMANENT", override = TRUE)

produces the following warning:

Warning message:

> In system(syscmd, intern = intern, ignore.stderr = ignore.stderr,  :
    running command 'g.proj.exe -w' had status 884

This doesn't happen when initialising a new grass location, (e.g. in R's temp file area), only when accessing an existing one. Using gmeta() also produces the same warning. I think I've traced the issue to here, https://github.com/rsbivand/rgrass7/blob/5801ed574b6aef6da272d9dbd1939770c21879e9/R/rgrass.R#L110

specifically the use of intern = TRUE. I think the error handling line that follows isn't catching this issue, because a simple status of 884 is returned rather than anything including the word 'ERROR'. I can't find an explanation of what status 884 implies.

This effect persists whether an RStudio project is active or not, and the same issue arises if I launch RStudio normally and use my own initialization script. Everything else seems to work fine, and I have been working with this location across several previous versions of R and GRASS without this message appearing.

rsbivand commented 2 years ago

After installing OSGeo4W, I can reproduce the warning. However, the problem seems to be the same starting GRASS from the OSGeo4W shell in demolocation. The WKT is output when typing g.proj -w in the OSGeo4W shell. But nothing is returned when typing g.proj -w in the GRASS GUI console, and timings are as erratic as when running getLocationProj() in Rgui (I didn't try RStudio). The previous problem was that rgdal was using a newer proj.db than WinGRASS or OSGeo4W, generating the error. Now this problem OSGeo4W seems to be different, whether the rgdal or OSGeo4W proj.db is accessed. Please try the same without any R/rgrass7 and check my observation.

rsbivand commented 2 years ago

Not only OSGeo4W, the WinGRASS stand-alone has the same problem. Issue opened in GRASS.

obrl-soil commented 2 years ago

After installing OSGeo4W, I can reproduce the warning. However, the problem seems to be the same starting GRASS from the OSGeo4W shell in demolocation. The WKT is output when typing g.proj -w in the OSGeo4W shell. But nothing is returned when typing g.proj -w in the GRASS GUI console, and timings are as erratic as when running getLocationProj() in Rgui (I didn't try RStudio). The previous problem was that rgdal was using a newer proj.db than WinGRASS or OSGeo4W, generating the error. Now this problem OSGeo4W seems to be different, whether the rgdal or OSGeo4W proj.db is accessed. Please try the same without any R/rgrass7 and check my observation.

Can confirm g.proj -w returns nothing in the GRASS GUI on my machine. GRASS 7.8.6RC2 on my home machine is the same. Thanks for opening the GRASS issue.

petrasovaa commented 6 months ago

This was fixed couple days ago in GRASS, see https://github.com/OSGeo/grass/pull/3306.