[GRASS-SVN] r44516 - grass/trunk/scripts/v.krige

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 2 06:10:29 EST 2010


Author: aghisla
Date: 2010-12-02 03:10:28 -0800 (Thu, 02 Dec 2010)
New Revision: 44516

Modified:
   grass/trunk/scripts/v.krige/v.krige.py
Log:
Grass.fatal errors when dependenciees are not found.

Modified: grass/trunk/scripts/v.krige/v.krige.py
===================================================================
--- grass/trunk/scripts/v.krige/v.krige.py	2010-12-02 11:02:16 UTC (rev 44515)
+++ grass/trunk/scripts/v.krige/v.krige.py	2010-12-02 11:10:28 UTC (rev 44516)
@@ -397,16 +397,12 @@
     # rpy2
     global robjects
     global rinterface
-    grass.message(_('Loading packages, please wait...'))
+    grass.message(_('Loading dependencies, please wait...'))
     try:
         import rpy2.robjects as robjects
         import rpy2.rinterface as rinterface #to speed up kriging? for plots.
-        haveRpy2 = True
     except ImportError:
-        print >> sys.stderr, _("Python module 'Rpy2' not found. Please install it and re-run v.krige.") # ok for other OSes?
-        haveRpy2 = False
-        if not haveRpy2:
-            sys.exit(1)
+        grass.fatal(_("Python module 'Rpy2' not found. Please install it and re-run v.krige.")) # ok for other OSes?
         
     # R packages check. Will create one error message after check of all packages.
     missingPackagesList = []
@@ -415,7 +411,7 @@
             missingPackagesList.append(each)
     if missingPackagesList:
         errorString = "R package(s) " + " ".join(["%s" % e for e in missingPackagesList] +  "missing. Install it/them and re-run v.krige.")
-        sys.exit(_(errorString))
+        grass.fatal(_(errorString))
     
 if __name__ == '__main__':
     if len(sys.argv) > 1:



More information about the grass-commit mailing list