[GRASS-SVN] r71833 - in grass/trunk/gui/wxpython: core gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 25 17:15:50 PST 2017
Author: wenzeslaus
Date: 2017-11-25 17:15:50 -0800 (Sat, 25 Nov 2017)
New Revision: 71833
Modified:
grass/trunk/gui/wxpython/core/globalvar.py
grass/trunk/gui/wxpython/gui_core/forms.py
Log:
wxGUI: use print function (no traceback, only proper error message with Python 3)
Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py 2017-11-26 01:11:43 UTC (rev 71832)
+++ grass/trunk/gui/wxpython/core/globalvar.py 2017-11-26 01:15:50 UTC (rev 71833)
@@ -11,6 +11,8 @@
@author Martin Landa <landa.martin gmail.com>
"""
+from __future__ import print_function
+
import os
import sys
import locale
@@ -100,16 +102,17 @@
tuple(version.split('.')))
except ImportError as e:
- print >> sys.stderr, 'ERROR: wxGUI requires wxPython. %s' % str(e)
- print >> sys.stderr, ('You can still use GRASS GIS modules in'
- ' the command line or in Python.')
+ print('ERROR: wxGUI requires wxPython. %s' % str(e),
+ file=sys.stderr)
+ print('You can still use GRASS GIS modules in'
+ ' the command line or in Python.', file=sys.stderr)
sys.exit(1)
except (ValueError, wxversion.VersionError) as e:
- print >> sys.stderr, 'ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(
- minVersion) + '%s.' % (str(e))
+ print('ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(
+ minVersion) + '%s.' % (str(e)), file=sys.stderr)
sys.exit(1)
except locale.Error as e:
- print >> sys.stderr, "Unable to set locale:", e
+ print("Unable to set locale:", e, file=sys.stderr)
os.environ['LC_ALL'] = ''
if not os.getenv("GRASS_WXBUNDLED"):
Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py 2017-11-26 01:11:43 UTC (rev 71832)
+++ grass/trunk/gui/wxpython/gui_core/forms.py 2017-11-26 01:15:50 UTC (rev 71833)
@@ -46,6 +46,8 @@
@author Stepan Turek <stepan.turek seznam.cz> (CoordinatesSelect)
"""
+from __future__ import print_function
+
import sys
import string
import textwrap
@@ -835,10 +837,10 @@
ret = self._gconsole.RunCmd(cmd, onDone=self.OnDone)
except AttributeError as e:
- print >> sys.stderr, "%s: Probably not running in wxgui.py session?" % (
- e)
- print >>sys.stderr, "parent window is: %s" % (
- str(self.parent))
+ print("%s: Probably not running in wxgui.py session?" % (
+ e), file=sys.stderr)
+ print("parent window is: %s" % (
+ str(self.parent)), file=sys.stderr)
else:
gcmd.Command(cmd)
@@ -3006,10 +3008,10 @@
# the default parameter display is added automatically
assert ' '.join(
task.get_cmd()) == "d.vect -i map=map_name layer=1 display=shape label_bcolor=red"
- print "Creation of task successful"
+ print("Creation of task successful")
# Test interface building with handmade grassTask,
# possibly outside of a GRASS session.
- print "Now creating a module dialog (task frame)"
+ print("Now creating a module dialog (task frame)")
task = gtask.grassTask()
task.name = "TestTask"
task.description = "This is an artificial grassTask() object intended for testing purposes."
More information about the grass-commit
mailing list