[GRASS-SVN] r73243 - in grass-addons/grass7: general/g.compare.md5 general/g.isis3mt imagery/i.fusion.hpf imagery/i.landsat8.qc imagery/i.landsat8.swlst imagery/i.ortho.corr raster/r.droka raster/r.hazard.flood raster/r.rock.stability raster/r.shalstab raster/r.valley.bottom vector/v.explode vector/v.flexure vector/v.lidar.mcc vector/v.link.precip vector/v.stream.profiler vector/v.tin.to.rast vector/v.what.spoly

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 3 22:57:32 PDT 2018


Author: neteler
Date: 2018-09-03 22:57:32 -0700 (Mon, 03 Sep 2018)
New Revision: 73243

Modified:
   grass-addons/grass7/general/g.compare.md5/g.compare.md5.py
   grass-addons/grass7/general/g.isis3mt/g.isis3mt.py
   grass-addons/grass7/imagery/i.fusion.hpf/i.fusion.hpf.py
   grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py
   grass-addons/grass7/imagery/i.landsat8.swlst/i.landsat8.swlst.py
   grass-addons/grass7/imagery/i.ortho.corr/i.ortho.corr.py
   grass-addons/grass7/raster/r.droka/r.droka.py
   grass-addons/grass7/raster/r.hazard.flood/r.hazard.flood.py
   grass-addons/grass7/raster/r.rock.stability/r.rock.stability.py
   grass-addons/grass7/raster/r.shalstab/r.shalstab.py
   grass-addons/grass7/raster/r.valley.bottom/r.valley.bottom.py
   grass-addons/grass7/vector/v.explode/v.explode.py
   grass-addons/grass7/vector/v.flexure/v.flexure.py
   grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py
   grass-addons/grass7/vector/v.link.precip/v.link.precip.py
   grass-addons/grass7/vector/v.stream.profiler/v.stream.profiler.py
   grass-addons/grass7/vector/v.tin.to.rast/v.tin.to.rast.py
   grass-addons/grass7/vector/v.what.spoly/v.what.spoly.py
Log:
addons: print() fixes for Python3

Modified: grass-addons/grass7/general/g.compare.md5/g.compare.md5.py
===================================================================
--- grass-addons/grass7/general/g.compare.md5/g.compare.md5.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/general/g.compare.md5/g.compare.md5.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -65,7 +65,7 @@
     try:
         fd = open(fileName,"rb")
     except IOError:
-        print "Unable to open the file in readmode:", fileName
+        print("Unable to open the file in read mode")
         return
     content = fd.readlines()
     fd.close()

Modified: grass-addons/grass7/general/g.isis3mt/g.isis3mt.py
===================================================================
--- grass-addons/grass7/general/g.isis3mt/g.isis3mt.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/general/g.isis3mt/g.isis3mt.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -72,7 +72,7 @@
 import re,string
 
 if "GISBASE" not in os.environ:
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 # initialize

Modified: grass-addons/grass7/imagery/i.fusion.hpf/i.fusion.hpf.py
===================================================================
--- grass-addons/grass7/imagery/i.fusion.hpf/i.fusion.hpf.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/imagery/i.fusion.hpf/i.fusion.hpf.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -184,7 +184,7 @@
 
 # check if within a GRASS session?
 if "GISBASE" not in os.environ:
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 # PyGRASS

Modified: grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py
===================================================================
--- grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -119,7 +119,7 @@
 import grass.script as grass
 
 if "GISBASE" not in os.environ:
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 

Modified: grass-addons/grass7/imagery/i.landsat8.swlst/i.landsat8.swlst.py
===================================================================
--- grass-addons/grass7/imagery/i.landsat8.swlst/i.landsat8.swlst.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/imagery/i.landsat8.swlst/i.landsat8.swlst.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -326,7 +326,7 @@
 from landsat8_mtl import Landsat8_MTL
 
 if "GISBASE" not in os.environ:
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 # globals

Modified: grass-addons/grass7/imagery/i.ortho.corr/i.ortho.corr.py
===================================================================
--- grass-addons/grass7/imagery/i.ortho.corr/i.ortho.corr.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/imagery/i.ortho.corr/i.ortho.corr.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -89,7 +89,7 @@
     # check if GISBASE is set
     if "GISBASE" not in os.environ:
         # return an error advice
-        print "You must be in GRASS GIS to run this program."
+        print("You must be in GRASS GIS to run this program.")
         sys.exit(1)
 
     # input raster map

Modified: grass-addons/grass7/raster/r.droka/r.droka.py
===================================================================
--- grass-addons/grass7/raster/r.droka/r.droka.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/raster/r.droka/r.droka.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -88,7 +88,7 @@
         sys.exit("grass.script can't be imported.")
 
 if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 def main():

Modified: grass-addons/grass7/raster/r.hazard.flood/r.hazard.flood.py
===================================================================
--- grass-addons/grass7/raster/r.hazard.flood/r.hazard.flood.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/raster/r.hazard.flood/r.hazard.flood.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -58,7 +58,7 @@
         sys.exit("grass.script can't be imported.")
 
 if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 def main():

Modified: grass-addons/grass7/raster/r.rock.stability/r.rock.stability.py
===================================================================
--- grass-addons/grass7/raster/r.rock.stability/r.rock.stability.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/raster/r.rock.stability/r.rock.stability.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -100,7 +100,7 @@
         sys.exit("grass.script can't be imported.")
 
 if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 def main():

Modified: grass-addons/grass7/raster/r.shalstab/r.shalstab.py
===================================================================
--- grass-addons/grass7/raster/r.shalstab/r.shalstab.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/raster/r.shalstab/r.shalstab.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -109,7 +109,7 @@
         sys.exit("grass.script can't be imported.")
 
 if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 

Modified: grass-addons/grass7/raster/r.valley.bottom/r.valley.bottom.py
===================================================================
--- grass-addons/grass7/raster/r.valley.bottom/r.valley.bottom.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/raster/r.valley.bottom/r.valley.bottom.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -117,7 +117,7 @@
 import random
 import string
 
-if not os.environ.has_key("GISBASE"):
+if not "GISBASE" in os.environ.keys():
     grass.message("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 

Modified: grass-addons/grass7/vector/v.explode/v.explode.py
===================================================================
--- grass-addons/grass7/vector/v.explode/v.explode.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.explode/v.explode.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -59,7 +59,7 @@
         from grass.script import core as grass
     except:
         if not os.environ.has_key("GISBASE"):
-            print "You must be in GRASS GIS to run this program."
+            print("You must be in GRASS GIS to run this program.")
             sys.exit(1)
         
 

Modified: grass-addons/grass7/vector/v.flexure/v.flexure.py
===================================================================
--- grass-addons/grass7/vector/v.flexure/v.flexure.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.flexure/v.flexure.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -166,12 +166,12 @@
     try:
         import gflex
     except:
-        print ""
-        print "MODULE IMPORT ERROR."
-        print "In order to run r.flexure or g.flexure, you must download and install"
-        print "gFlex. The most recent development version is available from"
-        print "https://github.com/awickert/gFlex."
-        print "Installation instructions are available on the page."
+        print("")
+        print("MODULE IMPORT ERROR.")
+        print("In order to run r.flexure or g.flexure, you must download and install")
+        print("gFlex. The most recent development version is available from")
+        print("https://github.com/awickert/gFlex")
+        print("Installation instructions are available on the page.")
         grass.fatal("Software dependency must be installed.")
 
     ##########

Modified: grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py
===================================================================
--- grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -88,7 +88,7 @@
     sys.exit(_("No GRASS-python library found"))
 
 if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
+    print("You must be in GRASS GIS to run this program.")
     sys.exit(1)
 
 GUIModulesPath = os.path.join(os.getenv("GISBASE"), "etc", "gui", "wxpython")

Modified: grass-addons/grass7/vector/v.link.precip/v.link.precip.py
===================================================================
--- grass-addons/grass7/vector/v.link.precip/v.link.precip.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.link.precip/v.link.precip.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -118,7 +118,7 @@
         io.write(options['type'])
         io.close
     except IOError as (errno,strerror):
-        print "I/O error({0}): {1}".format(errno, strerror)
+        print("I/O error({0}): {1}".format(errno, strerror))
 
 def firstConnect():
 
@@ -284,7 +284,7 @@
                         createVect(win)
 
         except IOError as (errno,strerror):
-            print "I/O error({0}): {1}".format(errno, strerror)
+            print("I/O error({0}): {1}".format(errno, strerror))
          
 
     if flags['p']:

Modified: grass-addons/grass7/vector/v.stream.profiler/v.stream.profiler.py
===================================================================
--- grass-addons/grass7/vector/v.stream.profiler/v.stream.profiler.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.stream.profiler/v.stream.profiler.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -219,7 +219,7 @@
         #terminalCATS = list(options['cat'])
         #while terminalCATS:
             #
-        print "Upstream direction not yet active!"
+        print("Upstream direction not yet active!")
         return
         """
         # Add new lists for each successive upstream river

Modified: grass-addons/grass7/vector/v.tin.to.rast/v.tin.to.rast.py
===================================================================
--- grass-addons/grass7/vector/v.tin.to.rast/v.tin.to.rast.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.tin.to.rast/v.tin.to.rast.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -49,7 +49,7 @@
         from grass.script import core as grass
     except:
         if not os.environ.has_key("GISBASE"):
-            print "You must be in GRASS GIS to run this program."
+            print("You must be in GRASS GIS to run this program.")
             sys.exit(1)
 
 grass_version = grass.version().get('version')[0:2]

Modified: grass-addons/grass7/vector/v.what.spoly/v.what.spoly.py
===================================================================
--- grass-addons/grass7/vector/v.what.spoly/v.what.spoly.py	2018-09-04 02:28:53 UTC (rev 73242)
+++ grass-addons/grass7/vector/v.what.spoly/v.what.spoly.py	2018-09-04 05:57:32 UTC (rev 73243)
@@ -72,7 +72,7 @@
         from grass.script import core as grass
     except:
         if not os.environ.has_key("GISBASE"):
-            print "You must be in GRASS GIS to run this program."
+            print("You must be in GRASS GIS to run this program.")
             sys.exit(1)
 
 try:



More information about the grass-commit mailing list