Skip to content

Commit f3f85ed

Browse files
committed
Ignore errors for sip with no setapi.
Apparently, this happens (see #20040 and related issues) sporadically. We don't care if we can't change the sip API version (if it's already been set), so also stop caring if the `setapi` function doesn't exist. This should simply cause the Qt4 backend to fail correctly later with an `ImportError` instead, and thus fall back to the next backend candidate. Fixes #20040.
1 parent 679ca17 commit f3f85ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/qt_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _setup_pyqt4_internal(api):
117117
for _sip_api in _sip_apis:
118118
try:
119119
sip.setapi(_sip_api, api)
120-
except ValueError:
120+
except (AttributeError, ValueError):
121121
pass
122122
from PyQt4 import QtCore, QtGui
123123
import sip # Always succeeds *after* importing PyQt4.

0 commit comments

Comments
 (0)