[GRASS-SVN] r30632 - grass/trunk/swig/python/examples

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 19 06:14:02 EDT 2008


Author: hamish
Date: 2008-03-19 06:14:02 -0400 (Wed, 19 Mar 2008)
New Revision: 30632

Modified:
   grass/trunk/swig/python/examples/m.distance
Log:
don't crash if not in GRASS

Modified: grass/trunk/swig/python/examples/m.distance
===================================================================
--- grass/trunk/swig/python/examples/m.distance	2008-03-19 10:07:48 UTC (rev 30631)
+++ grass/trunk/swig/python/examples/m.distance	2008-03-19 10:14:02 UTC (rev 30632)
@@ -42,9 +42,13 @@
 #%End
 
 
-import sys
-import os
+import os, sys
 
+if not os.environ.has_key("GISBASE"):
+    print "You must be in GRASS GIS to run this program."
+    sys.exit(1)
+
+
 def main(): 
 
     #### add your code here ####



More information about the grass-commit mailing list