[GRASS-SVN] r45116 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 20 17:21:01 EST 2011


Author: martinl
Date: 2011-01-20 14:21:01 -0800 (Thu, 20 Jan 2011)
New Revision: 45116

Modified:
   grass/trunk/lib/init/grass.py
Log:
check if gisrc is available when starting grass with `-text` switch


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2011-01-20 21:42:58 UTC (rev 45115)
+++ grass/trunk/lib/init/grass.py	2011-01-20 22:21:01 UTC (rev 45116)
@@ -195,7 +195,7 @@
     # Set the session grassrc file
     gisrc = os.path.join(tmpdir, "gisrc")
     os.environ['GISRC'] = gisrc
-
+    
     # remove invalid GISRC file to avoid disturbing error messages:
     try:
 	s = readfile(gisrcrc)
@@ -930,12 +930,18 @@
 
 #predefine monitor size for certain architectures
 if os.getenv('HOSTTYPE') == 'arm':
-    #small monitor on ARM (iPAQ, zaurus... etc)
+    # small monitor on ARM (iPAQ, zaurus... etc)
     os.environ['GRASS_HEIGHT'] = "320"
-    os.environ['GRASS_WIDTH'] = "240"
+    os.environ['GRASS_WIDTH']  = "240"
 
 # First time user - GISRC is defined in the GRASS script
 if not os.access(gisrc, os.F_OK):
+    if grass_gui == 'text' and len(args) == 0:
+        fatal(_("Unable to start GRASS. You can:\n"
+                " - Launch GRASS with '-gui' switch (`grass70 -gui`)\n"
+                " - Create manually GISRC file (%s)\n"
+                " - Launch GRASS with path to "
+                "the location/mapset as an argument (`grass70 /path/to/location/mapset`)") % gisrcrc)
     grass_intro()
 else:
     clean_temp()



More information about the grass-commit mailing list