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 print text
root = Tkinter.Tk() root = Tkinter.Tk()
w = Tkinter.Label(root, text=text) w = Tkinter.Label(root, justify=Tkinter.LEFT, padx = 10, text=text)
w.pack() w.pack()
root.mainloop() root.mainloop()

View File

@ -23,21 +23,42 @@
# Try to get wxPython # Try to get wxPython
try: try:
import wx import wx
except ImportError: except ImportError,err:
from Scyther import Misc 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 Please install this package in order to use the graphical user
interface of Scyther. interface of Scyther.
The [wxPython] packages can be found at http://www.wxpython.org/ The [wxPython] packages can be found at http://www.wxpython.org/
Ubuntu users: the wxPython packages are called 'python-wxgtk' followed by the 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. Note that you can still use the Scyther binaries in the 'Scyther' directory.
""")
The exact error was:
--------------------------------------------------------------------------------
%s
--------------------------------------------------------------------------------
""" % (errmsg,err))
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" import externals """ """ import externals """