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

GRASS GIS trac at osgeo.org
Sat Sep 7 21:09:15 PDT 2013

#2067: PyGRASS grid calls g.region at import time
 Reporter:  huhabla                                                                          |       Owner:  grass-dev@…              
     Type:  defect                                                                           |      Status:  new                      
 Priority:  blocker                                                                          |   Milestone:  7.0.0                    
Component:  Python                                                                           |     Version:  svn-trunk                
 Keywords:  wingrass, PyGRASS, Grid, Python, temporal framework, t.remove, t.rast.neighbors  |    Platform:  MSWindows 7              
      Cpu:  Unspecified                                                                      |  

Comment(by hamish):


 trunk/lib/python/pygrass/modules/grid/grid.py line 23 from the traceback
   _GREG = Module('g.region')

 which is used within cmd_exe(), to "Create a mapset, and execute a cmd

 there are a number of other Module() aliases created within, but no other
 at the top level of the file, all the others are within a function
 definition. (but if it stops on the first error maybe that's irrelevant)

 The Module() class is defined in
 trunk/lib/python/pygrass/modules/interface/module.py, the line there where
 the above failure is caught (L244) is:
     def __init__(self, cmd, *args, **kargs):
         self.name = cmd
             # call the command with --interface-description
             get_cmd_xml = subprocess.Popen([cmd, "--interface-
         except OSError:
             str_err = "Module %r not found, please check that the module
             raise GrassError(str_err % self.name)

 so apparently during the build anything calling that initialization
 function would want to be run in a dummy session, as is done to generate
 the header usage text for the html help pages. or the pygrass code change
 to simply skip past the step with a warning message if GISBASE is not set
 to anything.


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

More information about the grass-dev mailing list