From 915b2713a05208f8411570cc9a52533e8f264417 Mon Sep 17 00:00:00 2001 From: Stephen Watson Date: Sun, 20 May 2007 09:59:49 +0000 Subject: [PATCH] Prefer stderr.write() to print>>stderr, seems to work better with translations. Don't use the fancy exception browser if there is no display to show it on. (Stephen Watson) git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/rox-lib@5026 66de3db3-b00d-0410-b41b-f4738ad19bea --- ROX-Lib2/AppRun | 2 +- ROX-Lib2/python/rox/__init__.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ROX-Lib2/AppRun b/ROX-Lib2/AppRun index fd59cbb..e8a95ad 100755 --- a/ROX-Lib2/AppRun +++ b/ROX-Lib2/AppRun @@ -30,5 +30,5 @@ if rox.g.gdk.get_display() is not None: filer.open_dir(os.path.join(app_dir, "Help")) else: - print >>stderr, message + stderr.write(message+'\n') diff --git a/ROX-Lib2/python/rox/__init__.py b/ROX-Lib2/python/rox/__init__.py index fec1597..95601d7 100644 --- a/ROX-Lib2/python/rox/__init__.py +++ b/ROX-Lib2/python/rox/__init__.py @@ -80,8 +80,9 @@ except ImportError: sys.stderr.write(_('Broken pygtk installation: found pygtk (%s), but not gtk!\n') % pygtk.__file__) raise assert g.Window # Ensure not 1.2 bindings -if not g.gdk.get_display(): - print >>sys.stderr, _("WARNING from ROX-Lib: This does not appear to be a valid X environment (DISPLAY is not set), many functions will not work and may cause a segmentation fault.") +have_display=g.gdk.get_display() is not None +if not have_display: + sys.stderr.write(_("WARNING from ROX-Lib: This does not appear to be a valid X environment (DISPLAY is not set), many functions will not work and may cause a segmentation fault.")+"\n") # Put argv back the way it was, now that Gtk has initialised sys.argv[0] = _path @@ -187,8 +188,9 @@ def report_exception(): def _excepthook(ex_type, value, tb): _old_excepthook(ex_type, value, tb) if type(ex_type) == type and issubclass(ex_type, KeyboardInterrupt): return - import debug - debug.show_exception(ex_type, value, tb) + if have_display: + import debug + debug.show_exception(ex_type, value, tb) _old_excepthook = sys.excepthook sys.excepthook = _excepthook -- 2.11.4.GIT