Skip to content
Snippets Groups Projects
Commit e2bd8a34 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Attempt to clean up back-end setting

- Removes warning message
- Add another method to change the backend
parent c461bba6
No related branches found
No related tags found
1 merge request!67Attempt to clean up back-end setting
Pipeline #
......@@ -4,6 +4,7 @@ import os
import numpy as np
from math import fmod
import argparse
import traceback
# Constants
......@@ -298,13 +299,18 @@ def set_up_command_line_arguments():
command_line_args = set_up_command_line_arguments()
if 'DISPLAY' in os.environ:
logging.debug("DISPLAY={} environment found".format(os.environ['DISPLAY']))
pass
else:
logging.info('No $DISPLAY environment variable found, so importing \
matplotlib.pyplot with non-interactive "Agg" backend.')
import matplotlib
matplotlib.use('Agg')
non_gui_backends = matplotlib.rcsetup.non_interactive_bk
for backend in non_gui_backends:
try:
logging.debug("Trying backend {}".format(backend))
matplotlib.use(backend, warn=False)
matplotlib.pyplot.switch_backend(backend)
break
except Exception as e:
print(traceback.format_exc())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment