Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 091776d

Browse filesBrowse files
committed
Merge pull request matplotlib#1905 from jschueller/master
Prevent Qt4 from stopping the interpreter
2 parents 3ab0ba0 + 48e5bb1 commit 091776d
Copy full SHA for 091776d

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed

‎lib/matplotlib/backends/backend_qt4.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt4.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import division, print_function
22
import math
33
import os
4+
import re
45
import signal
56
import sys
67

@@ -53,6 +54,13 @@ def _create_qApp():
5354
global qApp
5455
app = QtGui.QApplication.instance()
5556
if app is None:
57+
58+
# check for DISPLAY env variable on X11 build of Qt
59+
if hasattr(QtGui, "QX11Info"):
60+
display = os.environ.get('DISPLAY')
61+
if display is None or not re.search(':\d', display):
62+
raise RuntimeError('Invalid DISPLAY variable')
63+
5664
qApp = QtGui.QApplication( [" "] )
5765
QtCore.QObject.connect( qApp, QtCore.SIGNAL( "lastWindowClosed()" ),
5866
qApp, QtCore.SLOT( "quit()" ) )

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.