Commit dd7a6ed6 authored by David Keitel's avatar David Keitel
Browse files

workaround for matplotlib on X-less remote logins

 -first check $DISPLAY environment variable
 -then use non-interactive "AGG" backend if necessary
parent 720f57fa
...@@ -6,7 +6,17 @@ import glob ...@@ -6,7 +6,17 @@ import glob
import subprocess import subprocess
import numpy as np import numpy as np
import matplotlib.pyplot as plt
# workaround for matplotlib on X-less remote logins
if os.environ.has_key('DISPLAY'):
import matplotlib.pyplot as plt
else:
logging.info('No $DISPLAY environment variable found, \
so importing matplotlib.pyplot with non-interactive "Agg" backend.')
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import scipy.special import scipy.special
import scipy.optimize import scipy.optimize
import lal import lal
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment