[GRASS-SVN] r60344 - grass-addons/grass7/raster/r.mwprecip

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 19 03:44:44 PDT 2014


Author: martinl
Date: 2014-05-19 03:44:43 -0700 (Mon, 19 May 2014)
New Revision: 60344

Modified:
   grass-addons/grass7/raster/r.mwprecip/r.mwprecip.py
Log:
r.mwprecip: fix pgwrapper import (second attempt)

Modified: grass-addons/grass7/raster/r.mwprecip/r.mwprecip.py
===================================================================
--- grass-addons/grass7/raster/r.mwprecip/r.mwprecip.py	2014-05-19 10:40:21 UTC (rev 60343)
+++ grass-addons/grass7/raster/r.mwprecip/r.mwprecip.py	2014-05-19 10:44:43 UTC (rev 60344)
@@ -18,12 +18,6 @@
 from math import sin, cos, atan2,degrees,radians, tan,sqrt,fabs 
 
 try:
-    sys.path.insert(0, os.path.join(os.environ['GISBASE'], 'etc', 'r.mwprecip'))
-    from pgwrapper import pgwrapper as pg
-except ImportError:
-    sys.exit("Cannot find 'pgwrapper' Python module")
-
-try:
     from grass.script import core as grass  
 except ImportError:
     sys.exit("Cannot find 'grass' Python module. Python is supported by GRASS from version >= 6.4")
@@ -594,6 +588,12 @@
     db_name = options['database']
     db_user = options['user']
     db_password = options['password']
+
+    try:
+        sys.path.insert(0, os.path.join(os.environ['GRASS_ADDON_BASE'], 'etc', 'r.mwprecip'))
+        from pgwrapper import pgwrapper as pg
+    except ImportError:
+        sys.exit("Cannot find 'pgwrapper' Python module")
     
     try:
         conninfo = { 'dbname' : db_name }



More information about the grass-commit mailing list