Skip to content

Commit

Permalink
demote sip API failure to warning from ImportError
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Jul 18, 2011
1 parent 10086a9 commit 657a41b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions IPython/external/qt_for_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import os
import sys

from IPython.utils.warn import warn

matplotlib = sys.modules.get('matplotlib')
if matplotlib and matplotlib.__version__ <= '1.0.1':
# 1.0.1 doesn't support pyside or v2, so stick with PyQt @v1,
Expand Down Expand Up @@ -70,13 +72,16 @@
from IPython.external.qt import QtCore, QtGui
except ValueError as e:
if 'API' in str(e):
# API mismatch, give more meaningful message
raise ImportError("""
# PyQt4 already imported, and APIv2 couldn't be set
# Give more meaningful message, and warn instead of raising
warn("""
Assigning the ETS variable `QT_API=pyqt` implies PyQt's v2 API for
QString and QVariant, but PyQt has already been imported
with v1 APIs. You must unset QT_API to work with PyQt4
with v1 APIs. You should unset QT_API to work with PyQt4
in its default mode.
""")
# allow it to still work
from PyQt4 import QtCore, QtGui
else:
raise

0 comments on commit 657a41b

Please sign in to comment.