rsbivand / rgrass

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

Can't run .bat commands like r.mask #25

Closed MxNl closed 3 years ago

MxNl commented 3 years ago

Hello,

I am using rgrass7_0.2-5 and standalone winGRASS 7.8.5-2 all installed in default directories with

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 17763)

I am starting GRASS with

library(rgrass7)
link2GI::linkGRASS7(raster,
  default_GRASS7 = c(
    "C:\\Program Files\\GRASS GIS 7.8",
    "GRASS GIS 7.8",
    "NSIS"
  )
)

Everything works as expected, except that I can't run .bat commands like r.mask or v.to.lines etc. It is pretty similar to what I have found here: r-sig-geo.2731867 I also get the error:

Error : XML content does not seem to be XML: 'and,
operable program or batch file.'
Zusätzlich: Warnmeldung:
In system(cmd0, intern = TRUE) :
  Ausführung von Kommando 'r.mask.bat --interface-description' ergab Status 1
Fehler in parseGRASS(cmd, legacyExec = legacyExec) : r.mask not parsed

Apart from this I haven't found anything related after spending some time on researching.

Do I have to set an ENVIRONMENT VARIABLE that I haven't thought of? I appreciate any help on this.

rsbivand commented 3 years ago

I can see the problem and will try to resolve it; thanks for reporting. The *.bat only hand off to python, so need special treatment.

rsbivand commented 3 years ago

It works correctly in GRASS 7.8.3, will search further tomorrow.

MxNl commented 3 years ago

Thanks for the quick response and your work!!!

rsbivand commented 3 years ago

With a freshly installed GRASS 7.8.5-2 stand-alone, I cannot reproduce your problem. parseGRASS("r.mask") runs correctly for me (Windows 10, R 4.0.3, current rgrass7). Note that I do not use link2GI, this depends on what they do, and I have not installed that package. This works for me with R started inside a GRASS location/mapset with:

library(rgrass7)
parseGRASS("r.mask")

or with GRASS started from R:

library(rgrass7)
initGRASS("C:\\Program Files\\GRASS GIS 7.8", tempfile())
parseGRASS("r.mask")

Please try either of these to remove the possibility that this is not caused by link2GI.

MxNl commented 3 years ago

Thanks, your hint solved this issue. This issue is caused by using link2GI.