[GRASS-SVN] r70271 - grass/trunk/lib/python/pydispatch

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 6 08:46:26 PST 2017


Author: wenzeslaus
Date: 2017-01-06 08:46:26 -0800 (Fri, 06 Jan 2017)
New Revision: 70271

Modified:
   grass/trunk/lib/python/pydispatch/saferef.py
Log:
pydispatch: use print function and stderr for error msg

Modified: grass/trunk/lib/python/pydispatch/saferef.py
===================================================================
--- grass/trunk/lib/python/pydispatch/saferef.py	2017-01-06 16:25:18 UTC (rev 70270)
+++ grass/trunk/lib/python/pydispatch/saferef.py	2017-01-06 16:46:26 UTC (rev 70271)
@@ -1,4 +1,6 @@
 """Refactored "safe reference" from dispatcher.py"""
+from __future__ import print_function
+
 import weakref, traceback, sys
 
 if sys.hexversion >= 0x3000000:
@@ -128,8 +130,9 @@
                     try:
                         traceback.print_exc()
                     except AttributeError:
-                        print '''Exception during saferef %s cleanup ''' \
-                              '''function %s: %s''' % (self, function, e)
+                        print('''Exception during saferef %s cleanup '''
+                              '''function %s: %s''' % (self, function, e),
+                              file=sys.stderr)
         self.deletionMethods = [onDelete]
         self.key = self.calculateKey(target)
         self.weakSelf = weakref.ref(getattr(target, im_self), remove)



More information about the grass-commit mailing list