Added an error message for the case, where the initial import of PyQt4 fails. 5_5_x

Sat, 19 Jul 2014 15:39:38 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 19 Jul 2014 15:39:38 +0200
branch
5_5_x
changeset 3710
0060733678b0
parent 3706
6265b4f8deb7
child 3712
09b6f92a82ca

Added an error message for the case, where the initial import of PyQt4 fails.

eric5.py file | annotate | diff | comparison | revisions
--- a/eric5.py	Sat Jul 19 13:56:43 2014 +0200
+++ b/eric5.py	Sat Jul 19 15:39:38 2014 +0200
@@ -37,8 +37,22 @@
 import time
 import logging
 
-from PyQt4.QtCore import qWarning, QLibraryInfo, QTimer
-from PyQt4.QtGui import QApplication
+try:
+    from PyQt4.QtCore import qWarning, QLibraryInfo, QTimer
+    from PyQt4.QtGui import QApplication
+except ImportError:
+    try:    # Py2 
+        import tkMessageBox as messagebox
+    except ImportError:
+        try:    # Py3
+            from tkinter import messagebox
+        except ImportError:
+            sys.exit(100)
+    messagebox.showerror(
+        "eric5 Error",
+        "PyQt4 could not be imported. Please make sure"
+        " it is installed and accessible.")
+    sys.exit(100)
 
 # some global variables needed to start the application
 args = None

eric ide

mercurial