Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48e5bb1

Browse files
author
jschueller
committed
Using a regex to check DISPLAY
1 parent 1cbce7d commit 48e5bb1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backends/backend_qt4.py

Lines changed: 2 additions & 1 deletion
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

@@ -57,7 +58,7 @@ def _create_qApp():
5758
# check for DISPLAY env variable on X11 build of Qt
5859
if hasattr(QtGui, "QX11Info"):
5960
display = os.environ.get('DISPLAY')
60-
if (display is None) or (not ':' in display):
61+
if display is None or not re.search(':\d', display):
6162
raise RuntimeError('Invalid DISPLAY variable')
6263

6364
qApp = QtGui.QApplication( [" "] )

0 commit comments

Comments
 (0)