[GRASS-SVN] r67879 - in grass/trunk: lib/python/temporal temporal/t.list

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 18 03:14:10 PST 2016


Author: lucadelu
Date: 2016-02-18 03:14:10 -0800 (Thu, 18 Feb 2016)
New Revision: 67879

Modified:
   grass/trunk/lib/python/temporal/list_stds.py
   grass/trunk/temporal/t.list/t.list.py
Log:
temporal: output parameter close file 

Modified: grass/trunk/lib/python/temporal/list_stds.py
===================================================================
--- grass/trunk/lib/python/temporal/list_stds.py	2016-02-18 10:40:26 UTC (rev 67878)
+++ grass/trunk/lib/python/temporal/list_stds.py	2016-02-18 11:14:10 UTC (rev 67879)
@@ -296,6 +296,8 @@
                         outfile.write('{st}\n'.format(st=output))
                     else:
                         print output
+    if outpath:
+        outfile.close()
     if connected:
         dbif.close()
 

Modified: grass/trunk/temporal/t.list/t.list.py
===================================================================
--- grass/trunk/temporal/t.list/t.list.py	2016-02-18 10:40:26 UTC (rev 67878)
+++ grass/trunk/temporal/t.list/t.list.py	2016-02-18 11:14:10 UTC (rev 67879)
@@ -107,7 +107,7 @@
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     first = True
-    
+
     if  gscript.verbosity() > 0 and not outpath:
         sys.stderr.write("----------------------------------------------\n")
 
@@ -122,9 +122,9 @@
         # Use the correct order of the mapsets, hence first the current mapset, then
         # alphabetic ordering
         mapsets = tgis.get_tgis_c_library_interface().available_mapsets()
-        
+
         if outpath:
-            outfile = open(outpath, 'w') 
+            outfile = open(outpath, 'w')
 
         # Print for each mapset separately
         for key in mapsets:
@@ -155,7 +155,7 @@
                         else:
                             print output
                         first = False
-            
+
                     for row in rows:
                         output = ""
                         count = 0
@@ -169,7 +169,8 @@
                             outfile.write("{st}\n".format(st=output))
                         else:
                             print output
-
+    if outpath:
+        outfile.close()
     dbif.close()
 
 if __name__ == "__main__":



More information about the grass-commit mailing list