[R-sig-Geo] grass.script not found in R+grass7 session

Roger Bivand Roger.Bivand at nhh.no
Sat Jan 12 13:16:41 CET 2013


On Fri, 11 Jan 2013, Roger Bivand wrote:

> On Fri, 11 Jan 2013, Jean-Baptiste wrote:
>
>> 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?
>
> 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.

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:

> sessionInfo()
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
> execGRASS("g.version")
GRASS 7.0.svn (2012)

Roger

>
> Roger
>
>> 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.
>> 
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list