[GRASS-dev] [GRASS GIS] #2067: PyGRASS grid calls g.region at import time

GRASS GIS trac at osgeo.org
Sun Sep 1 01:29:09 PDT 2013

#2067: PyGRASS grid calls g.region at import time
 Reporter:  huhabla                                                                |       Owner:  grass-dev@…              
     Type:  defect                                                                 |      Status:  new                      
 Priority:  normal                                                                 |   Milestone:  7.0.0                    
Component:  Python                                                                 |     Version:  svn-trunk                
 Keywords:  PyGRASS, Grid, Python, temporal framework, t.remove, t.rast.neighbors  |    Platform:  MSWindows 7              
      Cpu:  Unspecified                                                            |  
 There is an issue in pygrass that prevent the compilation of the temporal
 framework on windows[1,2]. The issue appears while importing
 grass.pygrass.modules.grid.grid. While import a new Module instance is
 created for g.region.

 IMHO its not a good decision to call a grass module directly on import. I
 would suggest to create a Module variable in GridModule that is only once
 created at the construction of the first GridModule object in a process

 [1] http://wingrass.fsv.cvut.cz/grass70/logs/log-r57559-690/error.log
 Traceback (most recent call last):
   File "c:/osgeo4w/usr/src/grass_trunk/dist.i686-pc-
 mingw32/scripts/t.remove.py", line 58, in <module>
     import grass.pygrass.modules as pyg
   File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-
 mingw32\etc\python\grass\pygrass\__init__.py", line 17, in <module>
     import modules
   File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-
 mingw32\etc\python\grass\pygrass\modules\__init__.py", line 11, in
     import grid
   File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-
 mingw32\etc\python\grass\pygrass\modules\grid\__init__.py", line 9, in
     import grid
   File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-
 mingw32\etc\python\grass\pygrass\modules\grid\grid.py", line 23, in
     _GREG = Module('g.region')
   File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-
 mingw32\etc\python\grass\pygrass\modules\interface\module.py", line 244,
 in __init__
     raise GrassError(str_err % self.name)
 grass.pygrass.errors.GrassError: "Module 'g.region' not found, please
 check that the module exist"
 make[3]: *** [t.remove.tmp.html] Error 1

Ticket URL: <http://trac.osgeo.org/grass/ticket/2067>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list