[GRASS-SVN] r70024 - grass-addons/grass7/raster/r.catchment

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 6 15:22:54 PST 2016


Author: isaacullah
Date: 2016-12-06 15:22:54 -0800 (Tue, 06 Dec 2016)
New Revision: 70024

Modified:
   grass-addons/grass7/raster/r.catchment/r.catchment.py
Log:
Minor edit to resolve issue with temporary files on Windows OS. Replaced old use of tempfile.NamedTemporaryFile with standard GRASS python interface to g.tempfile (grass.tempfile). This should mitigate issues on Windows.

Modified: grass-addons/grass7/raster/r.catchment/r.catchment.py
===================================================================
--- grass-addons/grass7/raster/r.catchment/r.catchment.py	2016-12-06 23:17:47 UTC (rev 70023)
+++ grass-addons/grass7/raster/r.catchment/r.catchment.py	2016-12-06 23:22:54 UTC (rev 70024)
@@ -321,11 +321,11 @@
         "units." % (int(cutoff), displayarea)))
     ####################################################
         grass.verbose(_('Creating output map'))
-        temp = grass.tempfile()
+        temp = open(grass.tempfile(), w+)
         temp.write('0 thru %s = %s\n' % (int(cutoff),  mapval))
         temp.flush()
         grass.run_command('r.reclass', overwrite=grass.overwrite(), input=cost,
-                    output='cost.reclass.%s' % pid, rules=temp.name)
+                    output='cost.reclass.%s' % pid, rules=temp)
         temp.close()
         grass.mapcalc("${out}=if(isnull(${cost}), null(), ${cost})",
                     overwrite=grass.overwrite(), quiet=True,



More information about the grass-commit mailing list