[GRASS-SVN] r37996 - grass-addons/vector/v.krige

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 20 06:16:58 EDT 2009


Author: martinl
Date: 2009-06-20 06:16:58 -0400 (Sat, 20 Jun 2009)
New Revision: 37996

Modified:
   grass-addons/vector/v.krige/v.krige.py
Log:
* there is no grass module
* import gselect


Modified: grass-addons/vector/v.krige/v.krige.py
===================================================================
--- grass-addons/vector/v.krige/v.krige.py	2009-06-20 09:17:43 UTC (rev 37995)
+++ grass-addons/vector/v.krige/v.krige.py	2009-06-20 10:16:58 UTC (rev 37996)
@@ -15,15 +15,8 @@
 for details.
 """
 
-import wx
 import os, sys
-#@FIXME(anne): this commented statement gives error: no module named script.
-# @martinl: what does grass.script mean?
-#import grass.script as grass 
-import grass 
 
-import wx.lib.flatnotebook as FN
-
 try:
     import rpy2.robjects as robjects
     haveRpy2 = True
@@ -31,6 +24,19 @@
     print >> sys.stderr, "Rpy2 not found. Please install it and re-run."
     haveRpy2 = False
 
+import grass.script as grass 
+
+GUIModulesPath = os.path.join(os.getenv("GISBASE"), "etc", "wxpython", "gui_modules")
+sys.path.append(GUIModulesPath)
+
+import globalvar
+if not os.getenv("GRASS_WXBUNDLED"):
+    globalvar.CheckForWx()
+import gselect
+
+import wx
+import wx.lib.flatnotebook as FN
+
 #@TODO(anne): check all dependencies and data at the beginning:
 # grass - rpy2 - R - one of automap/gstat/geoR
 # a nice splash screen like QGIS does can fit the purpose, with a log message on the bottom and
@@ -137,9 +143,13 @@
 
     def __getColumns(self, layer):
         """ Lists the numerical columns of the given layer. """
-        ColumnList = grass.db_describe(layer)['cols']
         # filter it to pick up numerical cols
-        NumericalColumnList = []
+        NumericalColumnList = list()
+        try:
+            ColumnList = grass.db_describe(layer)['cols']
+        except TypeError:
+            return NumericalColumnList
+        
         for i in ColumnList:
             if i[1] == 'INTEGER' or i[1] == 'DOUBLE PRECISION':
                 NumericalColumnList.append(i[0])



More information about the grass-commit mailing list