mailr28120 - /trunk/dep_check.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by tlinnet on November 28, 2015 - 11:57:
Author: tlinnet
Date: Sat Nov 28 11:57:41 2015
New Revision: 28120

URL: http://svn.gna.org/viewcvs/relax?rev=28120&view=rev
Log:
Fix for running relax at a server with no graphical display and using 
matplotlib.

The error was found by:
relax_trunk --time -s Relax_disp.test_repeat_cpmg -d

And the error generated was:
QXcbConnection: Could not connect to display
Aborted (core dumped)

The backend of matplotlib have to be changed.
This is for example described in:
http://stackoverflow.com/questions/2766149/possible-to-use-pyplot-without-display
http://stackoverflow.com/questions/8257385/automatic-detection-of-display-availability-with-matplotlib

The solution is:

import matplotlib
if not "DISPLAY" in environ:
    # Force matplotlib to not use any Xwindows backend.
    matplotlib.use('Agg')

Modified:
    trunk/dep_check.py

Modified: trunk/dep_check.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/dep_check.py?rev=28120&r1=28119&r2=28120&view=diff
==============================================================================
--- trunk/dep_check.py  (original)
+++ trunk/dep_check.py  Sat Nov 28 11:57:41 2015
@@ -28,7 +28,7 @@
 
 # Python modules.
 import platform
-from os import F_OK, access, sep
+from os import F_OK, access, environ, sep
 from re import sub
 import sys
 
@@ -133,6 +133,9 @@
 try:
     import matplotlib
     matplotlib_module = True
+    if not "DISPLAY" in environ:
+        # Force matplotlib to not use any Xwindows backend.
+        matplotlib.use('Agg')
 except ImportError:
     matplotlib_module = False
 




Related Messages


Powered by MHonArc, Updated Sat Nov 28 12:20:22 2015