From 3a6d65463fb2c9158c2599012ce896cc76c1813d Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Thu, 26 Apr 2012 14:27:00 +0200 Subject: [PATCH] Improving error reporting on wx import errors. --- gui/Scyther/Misc.py | 2 +- gui/scyther-gui.py | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/gui/Scyther/Misc.py b/gui/Scyther/Misc.py index 27609da..cf37b0b 100644 --- a/gui/Scyther/Misc.py +++ b/gui/Scyther/Misc.py @@ -144,7 +144,7 @@ def panic(text): print text root = Tkinter.Tk() - w = Tkinter.Label(root, text=text) + w = Tkinter.Label(root, justify=Tkinter.LEFT, padx = 10, text=text) w.pack() root.mainloop() diff --git a/gui/scyther-gui.py b/gui/scyther-gui.py index f76b318..4c19902 100755 --- a/gui/scyther-gui.py +++ b/gui/scyther-gui.py @@ -23,21 +23,42 @@ # Try to get wxPython try: import wx -except ImportError: +except ImportError,err: from Scyther import Misc - Misc.panic(""" -ERROR: -Could not find the required [wxPython] package. + errmsg = "Problem with importing the required [wxPython] package." + + if 'No module' in str(err): + errmsg = """Could not find the required [wxPython] package. Please install this package in order to use the graphical user interface of Scyther. The [wxPython] packages can be found at http://www.wxpython.org/ Ubuntu users: the wxPython packages are called 'python-wxgtk' followed by the -version number. +version number.""" + elif '32-bit mode' in str(err): + errmsg = """Problem with importing the required [wxPython] package. + +Possibly the problem is caused by wxPython only working in 32-bit mode currently. +You can try the following on the command line: + + $ export VERSIONER_PYTHON_PREFER_32_BIT=yes + $ ./scyther-gui.py""" + + Misc.panic(""" +ERROR: + +%s Note that you can still use the Scyther binaries in the 'Scyther' directory. - """) + +The exact error was: +-------------------------------------------------------------------------------- +%s +-------------------------------------------------------------------------------- + """ % (errmsg,err)) + + #--------------------------------------------------------------------------- """ import externals """