Improving error reporting on wx import errors.

This commit is contained in:
Cas Cremers 2012-04-26 14:27:00 +02:00
parent 5b985af776
commit 3a6d65463f
2 changed files with 28 additions and 7 deletions

View File

@ -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()

View File

@ -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 """