瀏覽代碼

temporal: output parameter close file

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67879 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 9 年之前
父節點
當前提交
be56db29ed
共有 2 個文件被更改,包括 8 次插入5 次删除
  1. 2 0
      lib/python/temporal/list_stds.py
  2. 6 5
      temporal/t.list/t.list.py

+ 2 - 0
lib/python/temporal/list_stds.py

@@ -296,6 +296,8 @@ def list_maps_of_stds(type, input, columns, order, where, separator,
                         outfile.write('{st}\n'.format(st=output))
                     else:
                         print output
+    if outpath:
+        outfile.close()
     if connected:
         dbif.close()
 

+ 6 - 5
temporal/t.list/t.list.py

@@ -107,7 +107,7 @@ def main():
     dbif = tgis.SQLDatabaseInterfaceConnection()
     dbif.connect()
     first = True
-    
+
     if  gscript.verbosity() > 0 and not outpath:
         sys.stderr.write("----------------------------------------------\n")
 
@@ -122,9 +122,9 @@ def main():
         # 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 @@ def main():
                         else:
                             print output
                         first = False
-            
+
                     for row in rows:
                         output = ""
                         count = 0
@@ -169,7 +169,8 @@ def main():
                             outfile.write("{st}\n".format(st=output))
                         else:
                             print output
-
+    if outpath:
+        outfile.close()
     dbif.close()
 
 if __name__ == "__main__":