Skip to content

grass.script not found in R+grass7 session

5 messages · Jean-Baptiste, Roger Bivand

#
Hi listers,

I am working on Ubuntu 12.04, R 2.15.2, GRASS 7.0. All function work fine in
a classic GRASS session.

I am trying to run GRASS interface in an R session with spgrass6 and
initGRASS function. When I am used a grass function with command system(), I
am getting the following error message :
"ImportError: No module named grass.script"

I checked python path from the GRASS terminal and getting the following
message :
/usr/local/grass-7.0.svn/etc/python

Any idea on how to fix this problem?
Thanks,

Jean-Baptiste



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grass-script-not-found-in-R-grass7-session-tp7582292.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
On Fri, 11 Jan 2013, Jean-Baptiste wrote:

            
None at all, with this level of detail in your account. A simple 
reproducible example is needed (at least with the SVN revision number of 
GRASS 7, it is the development version, and moves fast). You haven't 
included any details of the offending R code, or of the versions of 
packages (output of sessionInfo()). Finally, the right list is:

http://lists.osgeo.org/mailman/listinfo/grass-stats

for this kind of detailed question.

Roger

  
    
#
On Fri, 11 Jan 2013, Roger Bivand wrote:

            
Further, after updating GRASS 7 to revision 54605, I can run:

library(spgrass6)
data(meuse)
library(rgdal)
coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")
library(maptools)
SG <- Sobj_SpatialGrid(meuse)$SG
td <- tempdir()
loc <- initGRASS("/home/rsb/topics/GRASS/G7svn/grass-7.0.svn", td, SG)
loc
writeVECT6(meuse, "meuse", v.in.ogr_flags="o")

without problems. My sessionInfo() output:
R version 2.15.2 (2012-10-26)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] maptools_0.8-21 lattice_0.20-13 foreign_0.8-52  rgdal_0.8-01
[5] spgrass6_0.7-12 XML_3.95-0.1    sp_1.0-5

loaded via a namespace (and not attached):
[1] tools_2.15.2
GRASS 7.0.svn (2012)

Roger

  
    
#
On Sat, 12 Jan 2013, Roger Bivand wrote:

            
But:
Traceback (most recent call last):
   File 
"/home/rsb/topics/GRASS/G7svn/grass-7.0.svn/scripts/v.db.addcolumn", line 
43, in <module>
     import grass.script as grass
ImportError: No module named grass.script
Error in if (file.exists(file) == FALSE) if (!missing(asText) && asText == 
:
   argument is of length zero
In addition: Warning message:
running command 'v.db.addcolumn --interface-description' had status 1
Error in parseGRASS("v.db.addcolumn") : v.db.addcolumn not parsed
[1] ""
[1] "/home/rsb/topics/GRASS/G7svn/grass-7.0.svn"
sep="/"))
[1] "/home/rsb/topics/GRASS/G7svn/grass-7.0.svn/etc/python"
Command: v.db.addcolumn
Description: Adds one or more columns to the attribute table connected to 
a given vector map.
Keywords: vector, attribute table, database
Parameters:
   name: map, type: string, required: yes, multiple: no
   keydesc: name, keydesc_count: 1
...

so changes in GRASS require a modification to initGRASS(). I've committed 
a patch to the R-forge rspatial project, module spgrass6, revision 1333. 
Please report back if you can check the revised version - try:

  install.packages("spgrass6", repos="http://R-Forge.R-project.org")

once you see 0.7-13 and revision >=1333 in the spgrass6 box on:

https://r-forge.r-project.org/R/?group_id=1014

If others could try this too, also on other platforms, I'd be grateful.

Roger

  
    
1 day later
#
Perfect. The lastest version of spgrass6 (0.7-13, revision 1333) work fine
for me (Platform: i686-pc-linux-gnu (32-bit)
R version 2.15.2 + GRASS 7.0.svn (2012))

Thank you very much!
Cheers,

Jean-Baptiste





--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grass-script-not-found-in-R-grass7-session-tp7582292p7582310.html
Sent from the R-sig-geo mailing list archive at Nabble.com.