From 4cab253e7c8011699606d3e17febbf456e9dee17 Mon Sep 17 00:00:00 2001 From: ccremers Date: Mon, 13 Nov 2006 10:38:47 +0000 Subject: [PATCH] - Improved error reporting. --- gui/Scyther/XMLReader.py | 14 +++++++++++--- gui/scyther-gui.py | 10 +++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gui/Scyther/XMLReader.py b/gui/Scyther/XMLReader.py index 94221f1..5292d87 100644 --- a/gui/Scyther/XMLReader.py +++ b/gui/Scyther/XMLReader.py @@ -10,13 +10,22 @@ # cElementTree module # +import sys + # Check for cElementTree presence. Otherwise use ElementTree. useiter = True try: import cElementTree except ImportError: useiter = False - from elementtree import ElementTree + try: + from elementtree import ElementTree + except ImportError: + print """ +ERROR: Could not locate elementtree or cElementTree package. +Please install one of them in order to work with the Scyther python interface. + """ + sys.exit(1) ## Simply pick cElementTree #import cElementTree @@ -28,7 +37,6 @@ import Term import Attack import Trace import Claim -import sys class XMLReader(object): @@ -298,4 +306,4 @@ class XMLReader(object): else: print >>sys.stderr,"Warning unknown tag in attack: %s" % event.tag return attack - + diff --git a/gui/scyther-gui.py b/gui/scyther-gui.py index ec55264..74ef965 100755 --- a/gui/scyther-gui.py +++ b/gui/scyther-gui.py @@ -3,8 +3,16 @@ #--------------------------------------------------------------------------- """ Import externals """ -import wx import sys +try: + import wx +except ImportError: + print """ +ERROR: Could not find the required wxPython package. +Please install this package in order to use the graphical user +interface of Scyther. + """ + sys.exit(1) import os from optparse import OptionParser, SUPPRESS_HELP