Jelajahi Sumber

pydispatch: use print function and stderr for error msg

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70271 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 8 tahun lalu
induk
melakukan
4e66602e18
1 mengubah file dengan 5 tambahan dan 2 penghapusan
  1. 5 2
      lib/python/pydispatch/saferef.py

+ 5 - 2
lib/python/pydispatch/saferef.py

@@ -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 @@ class BoundMethodWeakref(object):
                     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)