Sometimes I run my script via ssh. This answer told me to set up
import matplotlib
#matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
when I get the undefined SCREEN
error by running the script via ssh. However with that preamble I cannot view the graphs interactively when I run the script on my local machine.
What's the condition to check if the screen is defined? I'd like to do
if SCREEN == None:
matplotlib.use('Agg')
How's the proper code for that, how can I check this?