From 2119ee3c658f728140c8a9c660e6ae451773b879 Mon Sep 17 00:00:00 2001 From: Chris Lawrence Date: Sat, 26 Aug 2006 01:57:09 +0000 Subject: [PATCH] Add UINotImportable exception handling --- reportbug_ui_newt.py | 11 ++++++++--- reportbug_ui_urwid.py | 7 +++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/reportbug_ui_newt.py b/reportbug_ui_newt.py index 8b2e0a5..ea96894 100644 --- a/reportbug_ui_newt.py +++ b/reportbug_ui_newt.py @@ -1,6 +1,6 @@ # Newt user interface for reportbug # Written by Chris Lawrence -# (C) 2001-04 Chris Lawrence +# (C) 2001-06 Chris Lawrence # # This program is freely distributable per the following license: # @@ -18,12 +18,17 @@ ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ## SOFTWARE. # -# $Id: reportbug_ui_newt.py,v 1.5.2.2 2006-08-22 16:28:56 lawrencc Exp $ +# $Id: reportbug_ui_newt.py,v 1.5.2.3 2006-08-26 01:57:09 lawrencc Exp $ -import commands, string, sys, snack, re, debianbts +import commands, string, sys, re, debianbts from reportbug_exceptions import * from urlutils import launch_browser +try: + import snack +except ImportError: + raise UINotImportable, 'Please install the python-newt package to use this interface.' + ISATTY = sys.stdin.isatty() try: diff --git a/reportbug_ui_urwid.py b/reportbug_ui_urwid.py index abdb96d..49cefab 100644 --- a/reportbug_ui_urwid.py +++ b/reportbug_ui_urwid.py @@ -22,20 +22,19 @@ # (LGPL) Version 2.1 or later. On Debian systems, this license is available # in /usr/share/common-licenses/LGPL # -# $Id: reportbug_ui_urwid.py,v 1.3.2.9 2006-08-22 16:28:56 lawrencc Exp $ +# $Id: reportbug_ui_urwid.py,v 1.3.2.10 2006-08-26 01:57:09 lawrencc Exp $ import commands, string, sys, re +from reportbug_exceptions import * try: import urwid.raw_display import urwid except ImportError: - print >> sys.stderr, 'Please install the python-urwid package to use this interface.' - sys.exit(1) + raise UINotImportable, 'Please install the python-urwid package to use this interface.' import reportbug -from reportbug_exceptions import * from urlutils import launch_browser ISATTY = sys.stdin.isatty()