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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 6 15:33:30 PST 2016


Author: isaacullah
Date: 2016-12-06 15:33:30 -0800 (Tue, 06 Dec 2016)
New Revision: 70026

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:23:44 UTC (rev 70025)
+++ grass-addons/grass7/raster/r.catchment/r.catchment.py	2016-12-06 23:33:30 UTC (rev 70026)
@@ -321,11 +321,12 @@
         "units." % (int(cutoff), displayarea)))
     ####################################################
         grass.verbose(_('Creating output map'))
-        temp = open(grass.tempfile(), 'w+')
+        t = grass.tempfile()
+	temp = file(t, '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)
+                    output='cost.reclass.%s' % pid, rules=t)
         temp.close()
         grass.mapcalc("${out}=if(isnull(${cost}), null(), ${cost})",
                     overwrite=grass.overwrite(), quiet=True,



More information about the grass-commit mailing list